Sha256: a4c0639c7f44af3671b07b4b0d1b11ddb4cce94499b0ffe320ecf0874dc0e250
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
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 def it_fails_with(status, &block) it "fails with :#{status}" do expect(response.success?).to eq(false) expect(response.result).to eq({}) expect(response.status).to eq(:forbidden) instance_eval(&block) if block_given? end end def it_succeeds(message='succeeds', &block) it message do expect(response.success?).to eq(true) instance_eval(&block) if block_given? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restpack_service-0.0.73 | lib/restpack_service/support/matchers.rb |