Last active
November 7, 2016 20:36
-
-
Save thiagoa/256f7f51624b3d5fc74c537b0a52c121 to your computer and use it in GitHub Desktop.
Twitter client factory second spec
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
context 'when config is not passed' do | |
before do | |
@consumer_key_backup = ENV['TWITTER_CONSUMER_KEY'] | |
@consumer_secret_backup = ENV['TWITTER_CONSUMER_SECRET'] | |
@access_token_backup = ENV['TWITTER_ACCESS_TOKEN'] | |
@access_token_secret_backup = ENV['TWITTER_ACCESS_TOKEN_SECRET'] | |
ENV['TWITTER_CONSUMER_KEY'] = 'ck' | |
ENV['TWITTER_CONSUMER_SECRET'] = 'cs' | |
ENV['TWITTER_ACCESS_TOKEN'] = 'at' | |
ENV['TWITTER_ACCESS_TOKEN_SECRET'] = 'ats' | |
end | |
after do | |
ENV['TWITTER_CONSUMER_KEY'] = @consumer_key_backup | |
ENV['TWITTER_CONSUMER_SECRET'] = @consumer_secret_backup | |
ENV['TWITTER_ACCESS_TOKEN'] = @access_token_backup | |
ENV['TWITTER_ACCESS_TOKEN_SECRET'] = @access_token_secret_backup | |
end | |
it 'picks config values from the environment' do | |
instance = TwitterClientFactory.new.call | |
expect(instance).to have_attributes( | |
'consumer_key' => 'ck', | |
'consumer_secret' => 'cs', | |
'access_token' => 'at', | |
'access_token_secret' => 'ats' | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment