Sha256: 8a412ec6d5e6bf285deaa9faa65cbb529af28682c3564762c9469f544569cc8f

Contents?: true

Size: 824 Bytes

Versions: 11

Compression:

Stored size: 824 Bytes

Contents

require_relative 'matchers/create_command'

def is_required(*params)
  params.each do |param|
    it ":#{param} parameter must be required" do
      expect(subject.class.input_filters.required_inputs).to include(param)
    end
  end
end

def is_optional(*params)
  params.each do |param|
    it ":#{param} parameter must be required" do
      expect(subject.class.input_filters.optional_inputs).to include(param)
    end
  end
end

def service_request_with(param, value, &block)
  context "when :#{param} = #{value.inspect}" do
    let(:params) do
      super().merge({ param => value })
    end
    it { yield(response.result) }
  end
end

def service_should_map(param, map)
  context param do
    map.each do |value, expected|
      service_request_with(param, value) { |r| r[param].should == expected }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
restpack_service-0.0.60 lib/restpack_service/support/matchers.rb
restpack_service-0.0.59 lib/restpack_service/support/matchers.rb
restpack_service-0.0.58 lib/restpack_service/support/matchers.rb
restpack_service-0.0.57 lib/restpack_service/support/matchers.rb
restpack_service-0.0.56 lib/restpack_service/support/matchers.rb
restpack_service-0.0.55 lib/restpack_service/support/matchers.rb
restpack_service-0.0.54 lib/restpack_service/support/matchers.rb
restpack_service-0.0.53 lib/restpack_service/support/matchers.rb
restpack_service-0.0.52 lib/restpack_service/support/matchers.rb
restpack_service-0.0.51 lib/restpack_service/support/matchers.rb
restpack_service-0.0.50 lib/restpack_service/support/matchers.rb