Created
May 13, 2015 20:19
-
-
Save woods/2ab302dc579aa6d35a09 to your computer and use it in GitHub Desktop.
How we might spec out the global current_partner method
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
# This lives in config/initializers/current_partner.rb | |
# A global method to return the current partner | |
def current_partner | |
Partner.current | |
end |
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
# This lives in spec/component/current_partner_spec.rb -- it's neither a model, controller, helper, nor presenter. | |
require 'component/component_spec_helper' | |
describe '#current_partner' do | |
it "exists globally and returns the current Partner object" do | |
expect(current_partner).to eq(Partner.current) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment