I've got the view helper method in my application helper:
module ApplicationHelper
def formatted_something(something)
"Hello, #{something}"
end
end
I want to access that method in my request spec:
require "spec_helper"
describe "something" do
include RequestSpecHelper
it "should display blogs list" do
visit something_url
page.should have_content formatted_something(@something.something)
end
end
It couldn't find formatted_something method.
You just need to include the relevant helper module in your describe
block, and it will be available in all nested specs:
describe "something" do
include RequestSpecHelper
include ApplicationHelper
...
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With