Sha256: 37fc94631204a19461eb1dbe067247531ebff6cb96db8b07e778afacfa655a4d

Contents?: true

Size: 716 Bytes

Versions: 16

Compression:

Stored size: 716 Bytes

Contents

module RSpec
  module ProtocolHelper
    PROTOCOLS = if ENV['TEST_LIMIT_PROTOCOLS']
      JSON.parse(ENV['TEST_LIMIT_PROTOCOLS'])
    else
      {
        json:    'JSON',
        msgpack: 'MsgPack'
      }
    end

    def vary_by_protocol(&block)
      RSpec::ProtocolHelper::PROTOCOLS.each do |protocol, description|
        context("using #{description} protocol", protocol: protocol, &block)
      end
    end
  end
end

RSpec.configure do |config|
  config.extend RSpec::ProtocolHelper

  config.before(:context, protocol: :json) do |context|
    context.class.let(:protocol) { :json }
  end

  config.before(:context, protocol: :msgpack) do |context|
    context.class.let(:protocol) { :msgpack }
  end
end


Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
ably-0.8.4 spec/support/protocol_helper.rb
ably-rest-0.8.3 lib/submodules/ably-ruby/spec/support/protocol_helper.rb
ably-0.8.3 spec/support/protocol_helper.rb
ably-rest-0.8.2 lib/submodules/ably-ruby/spec/support/protocol_helper.rb
ably-0.8.2 spec/support/protocol_helper.rb
ably-0.8.1 spec/support/protocol_helper.rb
ably-rest-0.8.1 lib/submodules/ably-ruby/spec/support/protocol_helper.rb
ably-0.8.0 spec/support/protocol_helper.rb
ably-0.7.6 spec/support/protocol_helper.rb
ably-rest-0.7.5 lib/submodules/ably-ruby/spec/support/protocol_helper.rb
ably-0.7.5 spec/support/protocol_helper.rb
ably-0.7.4 spec/support/protocol_helper.rb
ably-rest-0.7.3 lib/submodules/ably-ruby/spec/support/protocol_helper.rb
ably-0.7.2 spec/support/protocol_helper.rb
ably-0.7.1 spec/support/protocol_helper.rb
ably-0.7.0 spec/support/protocol_helper.rb