I have the following view spec:
RSpec.describe "boilerplates/index", type: :view do
it "Doesn't render empty topic" do
assign :boilerplates, [create(:boilerplate_original, topic: nil)]
render
expect(rendered).to have_css('.topic', text: '')
end
end
The view has the following line of code:
resource_class.status.values.each do ...
This line breaks in specs, as it tells me:
undefined method `status' for #<Class:0x00000104cb3ec8>
When investigating further, the resource_class
(which comes from InheritedResources) points to User
, but normally, it points to Boilerplate
.
It seems that Devise overrides the resource_class
helper method in view specs. How can this be prevented?