[ rspec ] test helper

app/helpers/application_helper.rb

module ApplicationHelper
def page_title
true
end
end

spec/helpers/application_helper_spec.rb

describe ApplicationHelper, type: :helper do
describe "#page_title" do
it "returns true" do
helper.page_title.should be_true
end
end
end

NOTE : We can use the keyword `helper`.

ref : https://relishapp.com/rspec/rspec-rails/v/2-4/docs/helper-specs/helper-spec,

type: => :helper

Explicity declare type as helper, in case it is not in the helper spec ( spec/inputs/something_input_spec.rb )

More info : https://stackoverflow.com/questions/11341136/how-to-tell-rails-rspec-that-spec-is-type-helper

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s