On Rails 4 when I execute rspec tests for a decorator I got the following error :
/app/spec/decorators/my_decorator_spec.rb:3:in `<top (required)>': uninitialized constant MyDecorator (NameError)
I'm surely missing something but I don't know what.
I generate the decorator
rails g decorator My
A spec/my_decorator_spec.rb file is generated, with the content :
require 'spec_helper'
describe MyDecorator do
end
Then I test
rspec spec/decorators/my_decorator_spec.rb
I didn't add anything in application.rb or spec_helper.rb. The decorator itself works correctly.
EDIT
It's weirder than I expected. When I test all rspec files, tests inside my decorator spec file are correctly executed.
It works :
rspec spec/
It doesn't :
rspec spec/decorators
rspec spec/decorators/my_decorator_spec.rb