Sha256: 7626c267ac25fe7b2223d12bd7e281c7ec99432df354b2521c2a2c4e321caf39
Contents?: true
Size: 1.38 KB
Versions: 6
Compression:
Stored size: 1.38 KB
Contents
describe InfinumJsonApiSetup::RSpec::Matchers::IncludeAllResourceIds do include TestHelpers::Matchers::Response describe 'usage' do context "when ID's match" do it 'matches' do response = response_with_ids([1, 2]) expect(response).to include_all_resource_ids([1, 2]) end it "doesn't consider ordering" do response = response_with_ids([1, 2, 3]) expect(response).to include_all_resource_ids([3, 2, 1]) end end context "when ID's don't match" do it 'fails and describes failure reason' do response = response_with_ids([1, 2, 3]) expect do expect(response).to include_all_resource_ids([4]) end.to fail_with("Expected response ID's([1, 2, 3]) to match [4]") end end context "when response isn't valid JSON" do it 'fails and describes failure reason' do response = response_with_body('') expect do expect(response).to include_all_resource_ids([1]) end.to fail_with('Failed to parse response body') end end context "when response doesn't contain data attribute" do it 'fails and describes failure reason' do response = response_with_body('{}') expect do expect(response).to include_all_resource_ids([1]) end.to fail_with('Failed to extract data from response body') end end end end
Version data entries
6 entries across 6 versions & 1 rubygems