Sha256: e6caa7ea0d30fc518578a6876875575d490d01584ceaad3b1005d92254a0154c

Contents?: true

Size: 1.85 KB

Versions: 25

Compression:

Stored size: 1.85 KB

Contents

require 'spec_helper'

describe 'expect_json_types options' do
  describe 'match_expected', match_expected: true, match_actual: false do
    it 'should require all expected properties' do
      mock_get 'simple_get'
      get '/simple_get'
      expect{ expect_json_types(name: :string, other: :string) }.to raise_error(ExpectationNotMetError)
    end

    it 'should not require the actual properties' do
      mock_get 'simple_get'
      get '/simple_get'
      expect_json_types(name: :string)
    end
  end

  describe 'match_actual', match_expected: false, match_actual: true do
    it 'should require all actual properties' do
      mock_get 'simple_get'
      get '/simple_get'
      expect{ expect_json_types(name: :string) }.to raise_error(ExpectationError)
    end

    it 'should not require the expected properties' do
      mock_get 'simple_get'
      get '/simple_get'
      expect_json_types(name: :string, age: :int, address: :null, other: :string)
    end
  end

  describe 'match_both', match_expected: true, match_actual: true do
    it 'should require all actual properties' do
      mock_get 'simple_get'
      get '/simple_get'
      expect{ expect_json_types(name: :string) }.to raise_error(ExpectationError)
    end

    it 'should require all expected properties' do
      mock_get 'simple_get'
      get '/simple_get'
      expect{ expect_json_types(name: :string, other: :string) }.to raise_error(ExpectationNotMetError)
    end
  end

  describe 'match_none', match_expected: false, match_actual: false do
    it 'should not require the actual properties' do
      mock_get 'simple_get'
      get '/simple_get'
      expect_json_types(name: :string)
    end

    it 'should not require the expected properties' do
      mock_get 'simple_get'
      get '/simple_get'
      expect_json_types(name: :string, age: :int, address: :null, other: :string)
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
airborne-0.2.4 spec/airborne/expectations/expect_json_types_options_spec.rb
airborne-0.2.3 spec/airborne/expectations/expect_json_types_options_spec.rb
airborne-0.2.2 spec/airborne/expectations/expect_json_types_options_spec.rb
airborne-0.2.1 spec/airborne/expectations/expect_json_types_options_spec.rb
airborne-0.2.0 spec/airborne/expectations/expect_json_types_options_spec.rb