Sha256: 6d4baf544e65d722fde16f60f4b0b6cd6a64ad460bbf80e83bf35755ed724d3e
Contents?: true
Size: 884 Bytes
Versions: 30
Compression:
Stored size: 884 Bytes
Contents
require 'spec_helper' require 'hashie/mash' require 'routemaster/responses/response_promise' describe Routemaster::Responses::ResponsePromise do %i[status headers body].each do |method| it "passes through '#{method}'" do promise = described_class.new { Hashie::Mash.new(method => 'foobar') } promise.execute expect(promise.public_send(method)).to eq('foobar') end end it "can have callbacks set" do passing_spy = spy('passing spy') promise = described_class.new { } success_promise = promise.on_success { passing_spy.on_success } promise.execute promise.value success_promise.value expect(passing_spy).to have_received(:on_success) end it 're-raises exceptions' do promise = described_class.new { raise 'foobar' } promise.execute expect { promise.status }.to raise_error(RuntimeError, 'foobar') end end
Version data entries
30 entries across 30 versions & 1 rubygems