Sha256: 579c24553ccf7f38d0d397433bd746a84b77aa25a035ac98562a0b29f3dbbaa5

Contents?: true

Size: 874 Bytes

Versions: 7

Compression:

Stored size: 874 Bytes

Contents

require_relative 'matchers/create_command'
require_relative 'matchers/single_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

7 entries across 7 versions & 1 rubygems

Version Path
restpack_service-0.0.67 lib/restpack_service/support/matchers.rb
restpack_service-0.0.66 lib/restpack_service/support/matchers.rb
restpack_service-0.0.65 lib/restpack_service/support/matchers.rb
restpack_service-0.0.64 lib/restpack_service/support/matchers.rb
restpack_service-0.0.63 lib/restpack_service/support/matchers.rb
restpack_service-0.0.62 lib/restpack_service/support/matchers.rb
restpack_service-0.0.61 lib/restpack_service/support/matchers.rb