I'm practicing the Ruby on Rails Tutorial, and I have a question about rspec.
When testing the method full_title defined in app/helpers/application_helper.rb,
module ApplicationHelper
def full_title(title)
base_title = "Ruby on Rails Tutorial Sample App"
if title.empty?
base_title
else
"#{base_title} | #{title}"
end
end # end of def
end
you don't have to include ApplicationHelper in spec/helpers/application_helper_spec.rb. While in the spec/requests/static_pages_spec.rb, you have to include ApplicationHelper, otherwise the test will be failed for undefined methodfull_title'`.
In my opinion, rspec will autoload file app/helpers/application_helper.rb, and you don't have to include it again. What's the difference of the two test example?