Hi
For the last 18 months I’ve been used to writing specs like this, which
was written with Merb 1.1.0.pre and RSpec 1.3:
module LanguageRepository
describe DataMapperAdapter do
it_should_behave_like “Contract: LanguageRepository”
def language_repository
DataMapperAdapter.new
end
end
end
This will happily find and instantiate
::LanguageRepository::DataMapperAdapter from the
models/language_repository folder.
However, using Rails 3.0.0.beta from master and Rspec 2.0.0.beta.2, I
get the following error:
- LanguageRepository::DataMapperAdapter storage and retrieval can
store
a Language and retrieve it by code
Failure/Error: DataMapperAdapter.new
uninitialized constant
Rspec::Core::ExampleGroup::NestedLevel_8::DataMapperAdapter
I have to change it to this to make it work:
def language_repository
LanguageRepository::DataMapperAdapter.new
end
Now, having just changed two moving parts (RSpec and web framework) I’m
not sure what correct behaviour is on anything. I don’t know how Rails
code auto-loading works, or how RSpec interacts with it.
Is the above behaviour a bug or a misunderstanding on my part?
Cheers
Ashley
–
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran