Хорошо, я сбит с толку. Я пытаюсь использовать musta с Test :: Unit под Rails 3.1, ранее успешно это делал с Rails 2.3.11.
В моем Gemfile есть следующее:
group :test do
gem 'shoulda'
end
(и я бегу bundle install
- bundle show shoulda
показывает c:/Ruby192/lib/ruby/gems/1.9.1/gems/shoulda-2.11.3
)
У меня есть следующий test_helper.rb
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'shoulda'
class ActiveSupport::TestCase
end
и следующий user_test.rb
require 'test_helper'
class UserTest < ActiveSupport::TestCase
should validate_presence_of :email
should validate_format_of(:email).with("user+throwaway@subdom.example.com").with_message(/valid email address/)
should validate_presence_of(:encrypted_password)
should validate_confirmation_of :password
end
Но когда я делаю ruby -Itest test\unit\user_test.rb
, я получаю следующую ошибку:
test/unit/user_test.rb:4:in `<class:UserTest>': undefined method `validate_presence_of' for UserTest:Class (NoMethodError)
Что мне не удалось правильно настроить?