Sha256: ed02f49eab6e795c9152d99d72a98a9fc8f7280acb027d8ed1bb245b84eb6a05

Contents?: true

Size: 889 Bytes

Versions: 2

Compression:

Stored size: 889 Bytes

Contents

#encoding: UTF-8

require 'spec_helper'
require 'ruby-box'

describe RubyBox::Session do
  before do
    @auth_code = double("OAuth2::Strategy::AuthCode")
    @client = double("OAuth2::Client")

    @client.stub(:auth_code) { @auth_code }
    OAuth2::Client.stub(:new) { @client }

    @session = RubyBox::Session.new({
      client_id: "client id",
      client_secret: "client secret"
    })
  end

  let(:redirect_uri) { "redirect_uri" }
  let(:state) { "state" }

  describe '#authorize_url' do
    it "should accept redirect_uri" do
      @auth_code.should_receive(:authorize_url).with({ redirect_uri: redirect_uri})
      @session.authorize_url(redirect_uri)
    end

    it "should accept redirect_uri and state" do
      @auth_code.should_receive(:authorize_url).with({ redirect_uri: redirect_uri, state: state})
      @session.authorize_url(redirect_uri, state)
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ruby-box-updated-1.16.0 spec/session_spec.rb
ruby-box-1.15.0 spec/session_spec.rb