Sha256: 7d2c857c14ce5392a6b74f790c229bae10eabd15ea241b06a96937c249c27829
Contents?: true
Size: 1.74 KB
Versions: 3
Compression:
Stored size: 1.74 KB
Contents
require File.join(File.dirname(__FILE__), "/../spec_helper") describe "EvernoteOAuth::Client" do before :each do @client = EvernoteOAuth::Client.new( consumer_key: 'consumer_key', consumer_secret: 'consumer_secret', sandbox: false, token: 'token', secret: 'secret' ) end context "#initialize" do it "assigns instance variables" do @client.instance_variable_get(:@consumer_key).should == 'consumer_key' @client.instance_variable_get(:@consumer_secret).should == 'consumer_secret' @client.instance_variable_get(:@sandbox).should == false @client.instance_variable_get(:@token).should == 'token' @client.instance_variable_get(:@secret).should == 'secret' end end context "#authorize" do it "assigns returns access token" do mock_access_token = mock(OAuth::AccessToken) mock_access_token.should_receive(:token).and_return('token') mock_access_token.should_receive(:secret).and_return('secret') mock_request_token = mock(OAuth::RequestToken) mock_request_token.should_receive(:get_access_token).and_return(mock_access_token) OAuth::RequestToken.stub(:new){mock_request_token} @client.authorize('token', 'secret').should == mock_access_token end end context "#request_token" do it "calls OAuth::Consumer#get_request_token" do mock_request_token = mock(OAuth::RequestToken) mock_consumer = mock(OAuth::Consumer) mock_consumer.should_receive(:options).and_return({}) mock_consumer.should_receive(:get_request_token).with({}).and_return(mock_request_token) @client.should_receive(:consumer).any_number_of_times.and_return(mock_consumer) @client.request_token.should == mock_request_token end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
evernote_oauth-0.2.2 | spec/evernote_oauth/client_spec.rb |
evernote_oauth-0.2.1 | spec/evernote_oauth/client_spec.rb |
evernote_oauth-0.2.0 | spec/evernote_oauth/client_spec.rb |