Created
July 26, 2012 18:41
-
-
Save jgaskins/3183715 to your computer and use it in GitHub Desktop.
Testing Rails helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ostruct' | |
require File.expand_path('../../../app/helpers/application_helper', __FILE__) | |
describe ApplicationHelper do | |
let(:current_user) { OpenStruct.new(email: 'me@example.com', name: 'Foo Bar') } | |
let(:view) { double('view') } | |
subject { view } | |
before do | |
view.extend ApplicationHelper | |
view.stub current_user: current_user | |
end | |
it 'does whatever an ApplicationHelper does' do | |
# Stub as necessary | |
# Insert expectations here | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment