-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
method not found with Rails 3.1.0RC1 #171
Comments
I also use rails 3.1 rc1 and I experience no problems group :test do
gem "rspec-rails", "~> 2.6.1.beta1"
gem 'shoulda', "~> 2.11.3"
end require 'spec_helper'
describe User do
it { should have_many(:folders) }
end |
I'm using test/unit without rspec. group :test do
gem 'shoulda'
end test_helper: require 'shoulda' test/unit/stop_test.rb require 'test_helper'
class StopTest < ActiveSupport::TestCase
should belong_to :trip
end #ruby -Itest test/unit/stop_test.rb
test/unit/stop_test.rb:4:in `<class:StopTest>': undefined method `belong_to' for StopTest:Class (NoMethodError)
from test/unit/stop_test.rb:3:in `<main>' |
Hi David, I think this is caused because the current stable version of shoulda looks for RAILS_ROOT to determine what to automatically load, but it's no longer available in Rails 3.1. As a temporary workaround (and before Shoulda 3.0 is stable), add this to your test_helper.rb: # Shoulda looks for RAILS_ROOT before loading shoulda/rails, and Rails 3.1
# doesn't have that anymore.
require 'shoulda/rails' |
Thanks Ryan, with the workaround works great. |
I'm going to leave this open, just to make sure we have everything resolved in Shoulda 3.0 beta. I think it might already be handled, but I don't want to lose track of it. |
For me |
This still isn't working for me. I get an |
The Rails 3.1 has been out for almost 2 months now, can we expect a definitive fix soon? Or is test/unit deprecated permanently? |
Hi all, does using shoulda-context 3.0.0 work? If not, please open an issue on shoulda-context. |
I have updated an app to Rails 3.1.0RC1 and the tests now give the error:
undefined method `have_many' for UserTest:Class (NoMethodError)
with all the shoulda matchers. Is like doesn't load shoulda but I have require 'shoulda' in test_helper.rb and require 'test_helper.rb' in the test file (the same test works with Rails 3.0.x).
Rails 3.1.0.rc1 with shoulda 2.11.3
The text was updated successfully, but these errors were encountered: