Skip to content

Instantly share code, notes, and snippets.

@woods
Created May 13, 2015 20:19
Show Gist options
  • Save woods/2ab302dc579aa6d35a09 to your computer and use it in GitHub Desktop.
Save woods/2ab302dc579aa6d35a09 to your computer and use it in GitHub Desktop.
How we might spec out the global current_partner method
# This lives in config/initializers/current_partner.rb
# A global method to return the current partner
def current_partner
Partner.current
end
# 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