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

Mock received unexpected message :metadata with (no args) #663

Closed
joel opened this Issue Aug 20, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@joel

joel commented Aug 20, 2012

With name example for let Rspec fail

let(:example) { mock() }

Failure/Error: Unable to find matching line from backtrace
  Mock "example" received unexpected message :metadata with (no args)
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-mocks-2.10.1/lib/rspec/mocks/error_generator.rb:80:in `__raise'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-mocks-2.10.1/lib/rspec/mocks/error_generator.rb:20:in `raise_unexpected_message_error'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-mocks-2.10.1/lib/rspec/mocks/proxy.rb:146:in `raise_unexpected_message_error'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-mocks-2.10.1/lib/rspec/mocks/test_double.rb:72:in `rescue in method_missing'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-mocks-2.10.1/lib/rspec/mocks/test_double.rb:69:in `method_missing'
# .rvm/gems/ruby-1.9.2-p290@global/gems/capybara-1.1.2/lib/capybara/rspec.rb:22:in `block (2 levels) in <top (required)>'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:178:in `instance_eval'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:178:in `instance_eval'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/hooks.rb:23:in `run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/hooks.rb:63:in `block in run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/hooks.rb:63:in `each'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/hooks.rb:63:in `run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/hooks.rb:400:in `run_hook'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:298:in `run_before_each_hooks'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:239:in `run_before_each'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:86:in `block in run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:195:in `with_around_each_hooks'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example.rb:84:in `run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:353:in `block in run_examples'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `map'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:349:in `run_examples'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:335:in `run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `block in run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `map'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `block in run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `map'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/example_group.rb:336:in `run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `map'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:28:in `block in run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/reporter.rb:34:in `report'
# .rvm/gems/ruby-1.9.2-p290@global/gems/rspec-core-2.10.1/lib/rspec/core/command_line.rb:25:in `run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.1/lib/spork/test_framework/rspec.rb:11:in `run_tests'
# .rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.1/lib/spork/run_strategy/forking.rb:13:in `block in run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.1/lib/spork/forker.rb:21:in `block in initialize'
# .rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.1/lib/spork/forker.rb:18:in `fork'
# .rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.1/lib/spork/forker.rb:18:in `initialize'
# .rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.1/lib/spork/run_strategy/forking.rb:9:in `new'
# .rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.1/lib/spork/run_strategy/forking.rb:9:in `run'
# .rvm/gems/ruby-1.9.2-p290@global/gems/spork-0.9.1/lib/spork/server.rb:48:in `run'
# .rvm/rubies/ruby-1.9.2-p29global/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
# .rvm/rubies/ruby-1.9.2-p29global/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
# .rvm/rubies/ruby-1.9.2-p29global/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
# .rvm/rubies/ruby-1.9.2-p29global/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
# .rvm/rubies/ruby-1.9.2-p29global/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'

@alindeman

This comment has been minimized.

Show comment
Hide comment
@alindeman

alindeman Aug 20, 2012

Contributor

Hmm, yah, example has special meaning within the test. Since let defines a method, example is overwriting RSpec's version.

example is documented so I'd consider its use public. Therefore, I think you'll just have to rename your let.

Hope this helps!

Contributor

alindeman commented Aug 20, 2012

Hmm, yah, example has special meaning within the test. Since let defines a method, example is overwriting RSpec's version.

example is documented so I'd consider its use public. Therefore, I think you'll just have to rename your let.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment