Sha256: 2c4b18f205e2ea011f8ee415ed73aff52c27c82842eadb9ddfc114c9d876eaa7

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

require "spec_helper"

RSpec.describe Ribose::Config do
  before { restore_to_default_config }
  after { restore_to_default_config }

  describe ".configure" do
    it "allows us to set our configuration" do
      api_host = "www.example.com"
      api_token = "SUPER_SECRET_API_TOKEN"
      user_email = "john.doe@example.com"

      Ribose.configure do |config|
        config.api_host = api_host
        config.api_token = api_token
        config.user_email = user_email
      end

      expect(Ribose.configuration.api_host).to eq(api_host)
      expect(Ribose.configuration.debug_mode?).to be_falsey
      expect(Ribose.configuration.api_token).to eq(api_token)
      expect(Ribose.configuration.user_email).to eq(user_email)
      expect(Ribose.configuration.web_url).to eq ["https", api_host].join("://")
    end
  end

  describe ".configuration" do
    it "returns the default configuration" do
      configuration = Ribose.configuration

      expect(configuration.api_token).to be_nil
      expect(configuration.api_host).to eq("www.ribose.com")
    end
  end

  def restore_to_default_config
    Ribose.configuration.api_token = nil
    Ribose.configuration.user_email = nil
    Ribose.configuration.api_host = "www.ribose.com"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ribose-0.4.1 spec/ribose/config_spec.rb
ribose-0.4.0 spec/ribose/config_spec.rb
ribose-0.3.2 spec/ribose/config_spec.rb
ribose-0.3.1 spec/ribose/config_spec.rb
ribose-0.3.0 spec/ribose/config_spec.rb
ribose-0.2.0 spec/ribose/config_spec.rb