Sha256: 9cbb33ae5796c964e13ed2f6f07849729952c63f1634854e405070aa037f4538

Contents?: true

Size: 1.14 KB

Versions: 47

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

RSpec.shared_examples 'payload is correct' do |request = true|
  include_examples 'body type'
  include_examples 'evostream::event new'
  include_examples 'instance variable model'
  include_examples 'type stream' unless request
  it { expect(type).to eql(type_default) }
end

RSpec.shared_examples 'payload isn\'t correct' do
  include_examples 'body type'
  include_examples 'evostream::event new'
  include_examples 'instance variable model'
  it { expect(type).not_to eql(type_default) }
end

RSpec.shared_examples 'body type' do
  it { expect(body.to_json).to be_kind_of(String) }
end

RSpec.shared_examples 'evostream::event new' do
  it { expect(Evostream::Event.new(type, payload.to_json)).not_to be nil }
end

RSpec.shared_examples 'instance variable model' do
  let(:model) { type.sub(/^(\w)/, &:capitalize) }
  let(:evo) { Evostream::Event.new(type, payload.to_json) }

  it { expect(evo.instance_variable_get(:@model)).to eql(model) }
end

RSpec.shared_examples 'type stream' do
  let(:stream) do
    Evostream::Events::OutStreamCreated.new(1234, payload).send(:what_flux)
  end

  it { expect(stream).to eql(type_stream) }
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
evostream-event-1.0.2.pre.75 spec/support/examples_events.rb
evostream-event-1.0.2.pre.74 spec/support/examples_events.rb
evostream-event-1.0.1 spec/support/examples_events.rb
evostream-event-1.0.1.pre.72 spec/support/examples_events.rb
evostream-event-1.0.0 spec/support/examples_events.rb
evostream-event-1.0.0.pre.69 spec/support/examples_events.rb
evostream-event-1.0.0.pre.65 spec/support/examples_events.rb
evostream-event-1.0.0.pre.59 spec/support/examples_events.rb
evostream-event-1.0.0.pre.58 spec/support/examples_events.rb
evostream-event-0.3.2.pre.57 spec/support/examples_events.rb
evostream-event-0.3.2.pre.56 spec/support/examples_events.rb
evostream-event-0.3.2.pre.55 spec/support/examples_events.rb
evostream-event-0.3.1 spec/support/examples_events.rb
evostream-event-0.3.1.pre.53 spec/support/examples_events.rb
evostream-event-0.3.1.pre.52 spec/support/examples_events.rb
evostream-event-0.3.0 spec/support/examples_events.rb
evostream-event-0.3.0.pre.48 spec/support/examples_events.rb
evostream-event-0.2.7 spec/support/examples_events.rb
evostream-event-0.2.7.pre.44 spec/support/examples_events.rb
evostream-event-0.2.6 spec/support/examples_events.rb