Im at Michael Hartl RoR Tutorial Chapter 8 and I have a problem. The test does not work because of "its" method for RSpec "undefined". Have you met something like this? what could be the reason? I checked everything and just like in the book ...
Here is my test code from user_spec.rb:
describe User do before { @user = User.new(name: "Example User", email: " user@example.com ", password: "foobar", password_confirmation: "foobar") } subject { @user } describe "remember token" do before { @user.save } its(:remember_token) { should_not be_blank } end ... ...
the result of running the tests, he says: the undefined `his' method for RSpec :: ExampleGroups :: User :: RememberToken: Class (NoMethodError):
MBP:sample_app smi$ bundle exec rspec spec /Users/smi/projects/sample_app/spec/models/user_spec.rb:12:in `block (2 levels) in <top (required)>': **undefined method `its' for RSpec::ExampleGroups::User::RememberToken:Class (NoMethodError)** from /Users/smi/.rvm/gems/ruby-2.0.0-p594/gems/rspec-core-3.1.7/lib/rspec/core/example_group.rb:325:in `module_exec' from /Users/smi/.rvm/gems/ruby-2.0.0-p594/gems/rspec-core-3.1.7/lib/rspec/core/example_group.rb:325:in `subclass' from /Users/smi/.rvm/gems/ruby-2.0.0-p594/gems/rspec-core-3.1.7/lib/rspec/core/example_group.rb:219:in `block in define_example_group_method' from /Users/smi/projects/sample_app/spec/models/user_spec.rb:10:in `block in <top (required)>' from /Users/smi/.rvm/gems/ruby-2.0.0-p594/gems/rspec-core-3.1.7/lib/rspec/core/example_group.rb:325:in `module_exec' from /Users/smi/.rvm/g.................
source share