spec/lib/percy/capybara/client/snapshots_spec.rb in percy-capybara-2.0.0 vs spec/lib/percy/capybara/client/snapshots_spec.rb in percy-capybara-2.0.1
- old
+ new
@@ -48,29 +48,31 @@
loader # Force evaluation now.
stub_request(:post, 'https://percy.io/api/v1/repos/percy/percy-capybara/builds/')
.to_return(status: 201, body: mock_build_response.to_json)
stub_request(:post, 'https://percy.io/api/v1/builds/123/snapshots/')
.to_return(status: 201, body: mock_snapshot_response.to_json)
- stub_request(:post, "https://percy.io/api/v1/builds/123/resources/")
- .with(body: /#{snapshot_resource_sha}/)
- .to_return(status: 201, body: {success: true}.to_json)
+ stub_request(:post, "https://percy.io/api/v1/builds/123/resources/")
+ .with(body: /#{snapshot_resource_sha}/)
+ .to_return(status: 201, body: {success: true}.to_json)
stub_request(:post, "https://percy.io/api/v1/snapshots/256/finalize")
.to_return(status: 200, body: {success: true}.to_json)
capybara_client.initialize_build
end
it 'creates a snapshot' do
expect(capybara_client.client).to receive(:create_snapshot)
- .with(anything, anything, {name: nil, widths: nil})
+ .with(anything, anything, {})
.and_call_original
expect(capybara_client.snapshot(page)).to eq(true)
end
- it 'passes through name and width options to the percy client if given' do
+ it 'passes through options to the percy client if given' do
expect(capybara_client.client).to receive(:create_snapshot)
- .with(anything, anything, {name: 'foo', widths: [320, 1024]})
+ .with(anything, anything, {name: 'foo', widths: [320, 1024], enable_javascript: true})
.and_call_original
- expect(capybara_client.snapshot(page, name: 'foo', widths: [320, 1024])).to eq(true)
+ 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 connection errors' do
expect(capybara_client.client).to receive(:create_snapshot)
.and_raise(Percy::Client::ConnectionFailed)