Created
June 16, 2014 14:21
-
-
Save cflipse/07a5cb0b5140bec7d6ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "active_model/lint" | |
require "test/unit/assertions" | |
shared_examples_for "ActiveModel" do | |
include ActiveModel::Lint::Tests | |
include Test::Unit::Assertions | |
before { @model = subject } | |
ActiveModel::Lint::Tests.public_instance_methods.map(&:to_s).grep(/^test/).each do |test| | |
example test.gsub("_", " ") do |example| | |
send test | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2) User it should behave like ActiveModel test to param | |
Failure/Error: send test | |
NoMethodError: | |
undefined method `assertions' for #<RSpec::ExampleGroups::User::ItShouldBehaveLikeActiveModel:0x007f6d49e30450> | |
Shared Example Group: "ActiveModel" called from ./spec/models/user_spec.rb:6 | |
# ./spec/support/active_model_lint.rb:12:in `block (3 levels) in <top (required)>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was running into the same error while upgrading Rails from 4.0 to 4.1. I was able to get around it by adding
attr_accessor :assertions
andself.assertions = 0
like so:Did you come up with a more elegant solution?