spec/lib/percy/capybara/client/snapshots_spec.rb in percy-capybara-2.3.5 vs spec/lib/percy/capybara/client/snapshots_spec.rb in percy-capybara-2.3.6

- old
+ new

@@ -77,9 +77,15 @@ result = capybara_client.snapshot( page, name: 'foo', widths: [320, 1024], enable_javascript: true) expect(result).to eq(true) expect(capybara_client.failed?).to eq(false) end + it 'safely handles snapshot bad request errors' do + error = Percy::Client::BadRequestError.new(400, '', '', '', 'snapshot error msg') + expect(capybara_client.client).to receive(:create_snapshot).and_raise(error) + expect(capybara_client.snapshot(page)).to eq(nil) + expect(capybara_client.failed?).to eq(false) # Build is not failed. + end it 'safely handles connection errors' do expect(capybara_client.client).to receive(:create_snapshot) .and_raise(Percy::Client::ConnectionFailed) expect(capybara_client.snapshot(page)).to eq(nil) expect(capybara_client.failed?).to eq(true)