我试图将操作名称存根以测试使用它的视图。
RSpec.describe 'user/new.html.erb', type: :view do
before helper.stub!(:action_name).and_return('new')
it 'displays the form to create a new client' do
assign :user, build(:user)
render
expect(rendered).to match 'Upload Image'
end
end
当我运行测试时,我正在
undefined method `stub!' for nil:NilClass