Casecommons / with_model

Dynamically build an Active Record model (with table) within a test context
http://www.casebook.net
MIT License
167 stars 18 forks source link

undefined method `stub_const' #10

Closed yossi-shasho closed 10 years ago

yossi-shasho commented 11 years ago

I get the following error while running guard and RSpec 2.12.2

Failure/Error: Unable to find matching line from backtrace
     NoMethodError:
       undefined method `stub_const' for #<RSpec::Core::ExampleGroup::Nested_1:0x007fd11c8f7498>

Any idea?

nertzy commented 11 years ago

Are you using RSpec's built-in mocking framework, or something else? If it's something else, that would explain it. We will need to think of a different way to stub constants in that case.

RSpec.configure do |config|
  config.mock_framework = :rspec
end

See: https://www.relishapp.com/rspec/rspec-core/docs/mock-framework-integration/mock-with-rspec

Until then, does version 0.2.6 work for you?

yossi-shasho commented 11 years ago

It occurred with the examples you gave in the main page. And yes, I'm using mocha for mocking... should I give 0.2.6 a shot?

killthekitten commented 11 years ago

+1 it occurs for me in the master branch of the table-for gem. mocha is used for mocking there.

DiegoSalazar commented 11 years ago

I also noticed it only works in some filters such as before(:each) rather than before(:all). Just one more thing to pay attention to.