Skip to content

Instantly share code, notes, and snippets.

@thiagoa
Last active October 10, 2016 16:02
Show Gist options
  • Save thiagoa/9cfa80059476e8a0f690c9fc0c50d55f to your computer and use it in GitHub Desktop.
Save thiagoa/9cfa80059476e8a0f690c9fc0c50d55f to your computer and use it in GitHub Desktop.
First twitter client factory spec
# spec/models/twitter_client_factory_spec.rb
require 'twitter'
require 'spec_helper'
require_relative '../../app/models/twitter_client_factory'
RSpec.describe TwitterClientFactory do
describe '#call' do
it 'builds a twitter client class with the passed config' do
instance = TwitterClientFactory.new.call(
'consumer_key' => 'ck',
'consumer_secret' => 'cs',
'access_token' => 'at',
'access_token_secret' => 'ats'
)
expect(instance).to be_a Twitter::REST::Client
expect(instance).to have_attributes(
'consumer_key' => 'ck',
'consumer_secret' => 'cs',
'access_token' => 'at',
'access_token_secret' => 'ats'
)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment