Sha256: 6bcd101d2148fcf164462022ee839c200134de58c95aa5e9aca5a35d59dd8913

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8

require_relative 'spec_helper'

describe "Riksteatern" do
  subject { Riksteatern }

  describe "configure" do
    it "can be configured" do
      subject.config.base_url.must_equal 'https://riksteatern.se:8181/api'

      subject.configure do |c|
        c.base_url = 'changed.url'
      end

      subject.config.base_url.must_equal 'changed.url'
    end

    it "can change the json parser lamda" do
      subject.configure do |c|
        c.json_parser = ->{ 'foo' }
      end

      subject.config.json_parser.call.must_equal 'foo'
    end
  end

  describe "config" do
    it "returns a (default) config object" do
      subject.config.must_be_instance_of Riksteatern::Config
    end
  end

  describe "api" do
    it "returns a (default) api object" do
      subject.api.must_be_instance_of Riksteatern::Api
    end
  end

  describe "account" do
    it "configures the username and password" do
      username = 'foo@bar.biz'
      password = 'FooBar'

      r = subject.account(username, password)

      r.config.username.must_equal username
      r.config.password.must_equal password
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riksteatern-0.0.1 spec/riksteatern_spec.rb