Sha256: 56353fa14c72fd507076594556da81c8fb4b7611b468cdb096552862714eadb8

Contents?: true

Size: 731 Bytes

Versions: 1

Compression:

Stored size: 731 Bytes

Contents

# encoding: utf-8

require 'minitest/spec'
require 'minitest/pride'
require 'minitest/autorun'

require_relative '../lib/riksteatern'

class BounceURI
  def self.get(uri)
    uri
  end
end

Riksteatern.configure do |c|
  c.http_client = BounceURI

  c.username = 'foo'
  c.password = 'bar'
end


$loaded_fixtures = {}

def fixture(name)
  $loaded_fixtures[name] ||= IO.read("spec/fixtures/#{name}.json")
end

def parsed_fixture(name)
  JSON.parse fixture(name)
end

def with_fixture(name, &block)
  Riksteatern.api.stub(:get_json, parsed_fixture(name), &block)
end

def with_data(data, &block)
  @last_params = nil
  subject.stub :get_data, ->(params){ @last_params = params; data }, &block
end

def last_params
  @last_params
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riksteatern-0.0.1 spec/spec_helper.rb