I'm using:
gem 'rails', '5.1.7'
and
rspec (3.7.0)
I'm trying to write RSpec and I need to skip the before_action CASClient::Frameworks::Rails::Filter
I tried to do it in before(:each)
before(:each) do
controller.class.class_eval do
skip_before_action CASClient::Frameworks::Rails::Filter
end
end
but the code gets executed many times and from 2nd time onward CASClient::Frameworks::Rails::Filter
cannot be found since it will be already removed by the first test case.
I want to do it using something similar to allow(student1).to receive(:name) { 'John Smith'}
but I don't know how to do it.
How can I skip the before_action?
According to the doc, the standard way to get around this in testing seems to be
before do
CASClient::Frameworks::Rails::Filter.fake('homer')
end