I have a PathsHelper that overwrites foo_url and foo_path by processing additional parameters as well as the context from the current url. This is included in ApplicationController.
Right now, I have:
describe ApplicationController do
describe "#foo_url" do
...
end
describe "#foo_path" do
...
end
end
I’m wondering whether it’s better to do something along the lines of:
describe PathsHelper do
describe "#foo_url" do
...
end
describe "#foo_path" do
...
end
end
If so, is there any reasonable way to set some instance variables in the helper test, as there are conditions based on the current url.
While RSpec does aim to focus on behaviour, I still spec complex helpers in helper specs. That’s why helper specs exist in RSpec in the first place 🙂