Sha256: 2560e1a68c80db6bc1859df8ce1638db07d5e259ab76569a5025b13057ec1a11

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

# encoding: utf-8

require_relative '../spec_helper'

describe "Config" do
  subject {
    Riksteatern::Config.new do |c|
      c.base_url = base_url
      c.username = 'foo@site.com'
      c.password = 'bar'
    end
  }

  let(:base_url) { 'https://base.url/api' }

  it "returns the base_url" do
    subject.base_url.must_equal base_url
  end

  describe "json_parser" do
    it "is a lambda by default" do
      subject.json_parser.
        call('{"foo":123}')['foo'].must_equal 123
    end

    it "can be changed" do
      subject.json_parser = "foo"
      subject.json_parser.must_equal "foo"
    end
  end

  describe "http_client" do
    it "is Net::HTTP by default" do
      subject.http_client.must_equal Riksteatern::HTTP
    end

    it "can be changed" do
      subject.http_client = "bar"
      subject.http_client.must_equal "bar"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riksteatern-0.0.1 spec/riksteatern/config_spec.rb