Sha256: ce563bbf0695873f54b81312c8633f19d3cea70228c002f1e16aed0eef3dadcf

Contents?: true

Size: 897 Bytes

Versions: 3

Compression:

Stored size: 897 Bytes

Contents

require 'spec_helper'

module ResponsiveService
  describe Responder do
    subject(:responder) { Responder.new(type) }
    let(:type) { :success }

    it 'yields when sent :success with a type of :success' do
      expect { |b| responder.success(&b) }.to yield_control
    end

    it 'does not yield when sent :failure with a type of :success' do
      expect { |b| responder.failure(&b) }.to_not yield_control
    end

    context 'when initialized with a message' do
      subject(:responder) { Responder.new(type, message) }
      let(:message) { double(:message) }

      specify { expect(responder.message).to eq message }

      context 'when additionally initialized with a context' do
        subject(:responder) { Responder.new(type, message, context) }
        let(:context) { double(:context) }

        specify { expect(responder.context).to eq context }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
responsive_service-0.0.3 spec/lib/responsive_service/responder_spec.rb
responsive_service-0.0.2 spec/lib/responsive_service/responder_spec.rb
responsive_service-0.0.1 spec/lib/responsive_service/responder_spec.rb