Sha256: f5c9bbea4f5b9bb23abfe18e855ad37c9e1c3e291a380bb12d88df109ceaad5f

Contents?: true

Size: 1004 Bytes

Versions: 8

Compression:

Stored size: 1004 Bytes

Contents

require 'spec_helper'

describe "Authy" do
  describe "api_key" do
    before(:each) do
      @default_api_key = Authy.api_key
      Authy.api_key = nil
      ENV["AUTHY_API_KEY"] = nil
    end

    after(:each) do
      Authy.api_key = @default_api_key
    end


    it "should set and read instance variable" do
      Authy.api_key = "foo"
      Authy.api_key.should == "foo"
    end

    it "should fallback to ENV variable" do
      ENV["AUTHY_API_KEY"] = "bar"
      Authy.api_key.should == "bar"
    end
  end

  describe "api_url" do
    before(:each) do
      @default_api_url = Authy.api_url
      Authy.api_url = nil
    end

    after(:each) do
      Authy.api_url = @default_api_url
    end

    it "should set and read instance variable" do
      Authy.api_url = "https://example.com/"
      Authy.api_url.should == "https://example.com/"
    end

    it "should fallback to default value" do
      Authy.api_url = nil
      Authy.api_url.should == "https://api.authy.com"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
authy-2.7.1 spec/authy/config_spec.rb
authy-2.7.0 spec/authy/config_spec.rb
authy-2.6.2 spec/authy/config_spec.rb
authy-2.6.1 spec/authy/config_spec.rb
authy-2.6.0 spec/authy/config_spec.rb
authy-2.5.0.pre spec/authy/config_spec.rb
authy-2.4.2 spec/authy/config_spec.rb
authy-2.4.1 spec/authy/config_spec.rb