Sha256: a121fc5f162195f8228bc5addec8680568459eeb9e43ca82a74efa87ddbcb5e3

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Socialcast::CommandLine do

  let(:custom_file) { File.join(File.dirname(__FILE__), '..', 'fixtures', 'custom_credentials.yml') }
  let(:stubbed_credentials) { File.join(File.dirname(__FILE__), '..', 'fixtures') }
  before { Socialcast::CommandLine.stub(:config_dir).and_return(stubbed_credentials) }

  describe '#credentials_file' do
    subject { Socialcast::CommandLine.credentials_file }
    context 'with ENV variable' do
      before { ENV['SC_CREDENTIALS_FILE'] = custom_file }
      after { ENV['SC_CREDENTIALS_FILE'] = nil }
      it { should == custom_file }
    end
    context 'without ENV variable' do
      it { should == File.join(Socialcast::CommandLine.config_dir, 'credentials.yml') }
    end
  end

  describe '#credentials' do
    subject { Socialcast::CommandLine.credentials }
    describe 'with ENV variable' do
      before { ENV['SC_CREDENTIALS_FILE'] = custom_file }
      after { ENV['SC_CREDENTIALS_FILE'] = nil }
      it { subject[:user].should == 'mike@socialcast.com' }
    end
    describe 'without ENV variable' do
      it { subject[:user].should == 'ryan@socialcast.com' }
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
socialcast-1.3.6 spec/socialcast/socialcast_spec.rb
socialcast-1.3.5 spec/socialcast/socialcast_spec.rb
socialcast-1.3.4 spec/socialcast/socialcast_spec.rb
socialcast-1.3.3 spec/socialcast/socialcast_spec.rb
socialcast-1.3.2 spec/socialcast/socialcast_spec.rb
socialcast-1.3.1 spec/socialcast/socialcast_spec.rb