Sha256: 7b5ca0c5c8c873d6d4e890948b732083e349610011d01a4e188207b0f7e8dd8e

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'
require 'google-simple-client/session'

module GoogleSimpleClient
  describe Session do
    describe '#initialize' do
      describe 'with all required options' do
        session = Session.new({
          client_id: 'cid',
          client_secret: 'secret',
          email: 'email',
          password: 'password'
        })

        it 'is properly initialized' do
          session.should be
        end
      end

      describe 'with missing required options' do
        it 'raises error when a required option is missing' do
          expect {
            Session.new({
              client_id: nil,
              client_secret: 'secret',
              email: 'email',
              password: 'password'
            })
          }.to raise_error Error
        end
      end

      describe 'with option :vebose = nil' do
        it 'is properly initialized' do
          session = Session.new({
            client_id: 'cid',
            client_secret: 'secret',
            email: 'email',
            password: 'password',
            verbose: nil
          })
          session.should be
        end
      end
      describe 'with options in init file' do
        before do
          File.open('.google-simple-client', 'w') do |f|
            f.puts('client_id: cid')
            f.puts('client_secret: secret')
            f.puts('email: email')
            f.puts('password: password')
          end
        end

        it 'uses the options from the local file' do
          Session.new
        end

        after do
          File.delete('.google-simple-client')
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
google-simple-client-0.1.2 spec/google-simple-client/session_spec.rb
google-simple-client-0.1.1 spec/google-simple-client/session_spec.rb