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
validate_presence_of throws wrong number of arguments error on Class inherit from ActiveResource::Base #348
Comments
What's the full backtrace? |
I'm sorry but there is no other backtrace at all and the test logs only are showing a number of commit and rollback commands resulting from my tests. UPDATE:
|
I looked at the tags and it looks like that it is broken since v2.1.0. At this point the validate_instance method in lib/shoulda/matchers/active_model/validation_message_finder.rb was edited to pass a context param. v2.0.0
v2.1.0
|
As reported in thoughtbot#348, model#valid? is called with one argument while ActiveResource::Validations only defines #valid? without an optional argument. The interface of ActiveResouce::Validations#valid? is the same for A'resource in Rails 3.2 and the one extracted into a gem. Rails 3.2 version: https://github.com/rails/rails/blob/3-2-stable/activeresource/lib/active_resource/validations.rb#L123 Gem version: https://github.com/rails/activeresource/blob/master/lib/active_resource/validations.rb#L160
As reported in #348, model#valid? is called with one argument while ActiveResource::Validations only defines #valid? without an optional argument. The interface of ActiveResouce::Validations#valid? is the same for A'resource in Rails 3.2 and the one extracted into a gem. Rails 3.2 version: https://github.com/rails/rails/blob/3-2-stable/activeresource/lib/active_resource/validations.rb#L123 Gem version: https://github.com/rails/activeresource/blob/master/lib/active_resource/validations.rb#L160
PR #352 was merged so I'm closing this. |
Hi @mcmire! I'm facing exactly the same problem. I'm using Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end in Do you have any suggestion? |
@fabianoalmeida What's the error you're getting and what's the backtrace? |
same here runned: it { should validate_presence_of(:warehouse) }
` |
Hi,
got an error with version 2.3.0 that hasn't occured in previous versions:
tested with
throws with shoulda 3.5.0 and shoulda-matchers 2.3.0 following error:
Are there any suggestions or things I've been missing?
Best Christoph
The text was updated successfully, but these errors were encountered: