Sha256: 47154db478c450887352a3fcd80b897fd401ac4e61ad76d62f8062bb901c911f

Contents?: true

Size: 1.43 KB

Versions: 13

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'
require 'date'

describe 'expect_json_types with date' do
  it 'should verify correct date types' do
    mock_get('date_response')
    get '/date_response'
    expect_json_types(createdAt: :date)
  end

  it 'should verify correct date types with path' do
    mock_get('date_response')
    get '/date_response'
    expect_json_types('createdAt', :date)
  end
end

describe 'expect_json with date' do
  it 'should verify correct date value' do
    mock_get('date_response')
    get '/date_response'
    prev_day = DateTime.new(2014, 10, 19)
    next_day = DateTime.new(2014, 10, 21)
    expect_json(createdAt: date { |value| expect(value).to be_between(prev_day, next_day) })
  end
end

describe 'expect_json_types with date_or_null' do
  it 'should verify date_or_null when date is null' do
    mock_get('date_is_null_response')
    get '/date_is_null_response'
    expect_json_types(dateDeleted: :date_or_null)
  end

  it 'should verify date_or_null when date is null with path' do
    mock_get('date_is_null_response')
    get '/date_is_null_response'
    expect_json_types('dateDeleted', :date_or_null)
  end

  it 'should verify date_or_null with date' do
    mock_get('date_response')
    get '/date_response'
    expect_json_types(createdAt: :date_or_null)
  end

  it 'should verify date_or_null with date with path' do
    mock_get('date_response')
    get '/date_response'
    expect_json_types('createdAt', :date_or_null)
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
airborne-0.3.7 spec/airborne/expectations/expect_json_types_date_spec.rb
airborne-0.3.6 spec/airborne/expectations/expect_json_types_date_spec.rb
airborne-0.3.5 spec/airborne/expectations/expect_json_types_date_spec.rb
hops-airborne-0.2.17 spec/airborne/expectations/expect_json_types_date_spec.rb
airborne-0.3.4 spec/airborne/expectations/expect_json_types_date_spec.rb
airborne-0.3.3 spec/airborne/expectations/expect_json_types_date_spec.rb
airborne-0.3.2 spec/airborne/expectations/expect_json_types_date_spec.rb
airborne-0.3.1 spec/airborne/expectations/expect_json_types_date_spec.rb
airborne-0.3.0 spec/airborne/expectations/expect_json_types_date_spec.rb
hops-airborne-0.2.16 spec/airborne/expectations/expect_json_types_date_spec.rb
hops-airborne-0.2.15 spec/airborne/expectations/expect_json_types_date_spec.rb
airborne-0.2.13 spec/airborne/expectations/expect_json_types_date_spec.rb
airborne-0.2.12 spec/airborne/expectations/expect_json_types_date_spec.rb