Created
June 10, 2013 21:32
-
-
Save donovanbray/5752530 to your computer and use it in GitHub Desktop.
test sample
This file contains hidden or 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
describe User, 'as super_admin' do | |
subject { Factory(:super_admin, :email => '[email protected]')} | |
before(:each) do | |
PartnerScope.with(Partner.serve) { Factory(:super_admin, :email => '[email protected]') } | |
end | |
describe "#super_admin_for" do | |
it "returns multiple partners" do | |
expect(subject.super_admin_for).to have_at_least(2).items | |
end | |
it "doesn't include partners without a lib/config/partners configuration" do | |
# this occurs when a more recent build has been deployed to an ecosystem, then | |
# an older build is deployed that doesn't have the configuration for that partner. | |
partner = Factory(:partner, :slug => "noexist", :abbreviation => 'noexist', :url => "http://noexist.localhost") | |
# the email address formatter makes a call that expects a configuration to be present and will fail the test prematurely. | |
EmailAddress.should_receive(:valid_format).and_return(EmailAddress::DEFAULT_EMAIL_FORMAT) | |
# the email address spamtrap? makes a call that expects a configuration to be present and will fail the test prematurely. | |
EmailAddress.should_receive(:spamtrap?).and_return(false) | |
PartnerScope.with(partner) { Factory(:super_admin, :email => '[email protected]') } | |
expect(subject.super_admin_for.find{|p| p.slug == 'noexist'}).to be_empty | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current problem is the partner.config.restrict_by_email call.