To reproduce, create a new rails 4.2.1 project, add rspec-rails and generator_spec to Gemfile, run rails generate rspec:install, then create the following generator test:
require 'rails_helper'
require 'generator_spec'
describe 'foo', type: :generator do
it 'works' do
expect([]).to be_empty
end
end
This will fail:
1) foo works
Failure/Error: expect([]).to be_empty
NoMethodError:
undefined method `be_empty' for #<#<Class:0x007ff272fac398>:0x007ff272fac2d0>
# ./spec/generators/foo_spec.rb:6:in `block (2 levels) in <top (required)>'
But if we remove the type: :generator, it will work.
To reproduce, create a new rails 4.2.1 project, add
rspec-rails
andgenerator_spec
to Gemfile, runrails generate rspec:install
, then create the following generator test:This will fail:
But if we remove the
type: :generator
, it will work.