percy-capybara 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c84f5ed6c72de98416d621dfd3ab46867ea78d2
4
- data.tar.gz: 7977a4ed7022626bbdb14ca3323b6def95c5e9d8
3
+ metadata.gz: 9bbb4516a98285f5ed9b0b812adcef690b8686e0
4
+ data.tar.gz: ddb0cbdd5e8bf72ebd8db055d58785b544d2832e
5
5
  SHA512:
6
- metadata.gz: 3958fb07643023624bd6e38a6541b806e80355c749245b5c8c4d0b76944b9c8e66985428ad80e386224da8886f68c9cd2a18fa107a7faf354e4771422a92cd4f
7
- data.tar.gz: 6ac2f13f3775fc18fe1289ce982fb1758e774b4cc5522161e40f4faf82f493704c4e2fe4b2435c51f7aac7051f93ddf7cb633252a98b33ebea5271e3a9be8b48
6
+ metadata.gz: d120cbf4e1617f544a021775ca87dc9f4ff791474ca557cb63dd7d68a69e8514409b2e82e3c00a4be56d0e077bd53fabe4a7715cb1bb4dc7991362abb5aa4a0c
7
+ data.tar.gz: 39349c21063c63c6958e0917478155f272e0f7e60208e1972c990a8a7b96e20561f2b98bfcee68ed9aa3cbecf026fcdcbd3fc89cdf02e6d597bbe4c4413960f5
@@ -14,11 +14,9 @@ module Percy
14
14
  def snapshot(page, options = {})
15
15
  return if !enabled? # Silently skip if the client is disabled.
16
16
 
17
- name = options[:name]
18
- widths = options[:widths]
19
17
  loader = initialize_loader(page: page)
20
18
 
21
- Percy.logger.debug { "Snapshot started (name: #{name.inspect})" }
19
+ Percy.logger.debug { "Snapshot started (name: #{options[:name].inspect})" }
22
20
  start = Time.now
23
21
  current_build_id = current_build['data']['id']
24
22
  resources = loader.snapshot_resources
@@ -32,12 +30,7 @@ module Percy
32
30
  # Create the snapshot and upload any missing snapshot resources.
33
31
  start = Time.now
34
32
  rescue_connection_failures do
35
- snapshot = client.create_snapshot(
36
- current_build_id,
37
- resources,
38
- name: name,
39
- widths: widths,
40
- )
33
+ snapshot = client.create_snapshot(current_build_id, resources, options)
41
34
  snapshot['data']['relationships']['missing-resources']['data'].each do |missing_resource|
42
35
  sha = missing_resource['id']
43
36
  client.upload_resource(current_build_id, resource_map[sha].content)
@@ -1,5 +1,5 @@
1
1
  module Percy
2
2
  module Capybara
3
- VERSION = '2.0.0'
3
+ VERSION = '2.0.1'
4
4
  end
5
5
  end
@@ -50,9 +50,9 @@ RSpec.describe Percy::Capybara::Client::Snapshots, type: :feature do
50
50
  .to_return(status: 201, body: mock_build_response.to_json)
51
51
  stub_request(:post, 'https://percy.io/api/v1/builds/123/snapshots/')
52
52
  .to_return(status: 201, body: mock_snapshot_response.to_json)
53
- stub_request(:post, "https://percy.io/api/v1/builds/123/resources/")
54
- .with(body: /#{snapshot_resource_sha}/)
55
- .to_return(status: 201, body: {success: true}.to_json)
53
+ stub_request(:post, "https://percy.io/api/v1/builds/123/resources/")
54
+ .with(body: /#{snapshot_resource_sha}/)
55
+ .to_return(status: 201, body: {success: true}.to_json)
56
56
  stub_request(:post, "https://percy.io/api/v1/snapshots/256/finalize")
57
57
  .to_return(status: 200, body: {success: true}.to_json)
58
58
  capybara_client.initialize_build
@@ -60,16 +60,18 @@ RSpec.describe Percy::Capybara::Client::Snapshots, type: :feature do
60
60
 
61
61
  it 'creates a snapshot' do
62
62
  expect(capybara_client.client).to receive(:create_snapshot)
63
- .with(anything, anything, {name: nil, widths: nil})
63
+ .with(anything, anything, {})
64
64
  .and_call_original
65
65
  expect(capybara_client.snapshot(page)).to eq(true)
66
66
  end
67
- it 'passes through name and width options to the percy client if given' do
67
+ it 'passes through options to the percy client if given' do
68
68
  expect(capybara_client.client).to receive(:create_snapshot)
69
- .with(anything, anything, {name: 'foo', widths: [320, 1024]})
69
+ .with(anything, anything, {name: 'foo', widths: [320, 1024], enable_javascript: true})
70
70
  .and_call_original
71
71
 
72
- expect(capybara_client.snapshot(page, name: 'foo', widths: [320, 1024])).to eq(true)
72
+ result = capybara_client.snapshot(
73
+ page, name: 'foo', widths: [320, 1024], enable_javascript: true)
74
+ expect(result).to eq(true)
73
75
  expect(capybara_client.failed?).to eq(false)
74
76
  end
75
77
  it 'safely handles connection errors' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: percy-capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perceptual Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: percy-client
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
241
  version: '0'
242
242
  requirements: []
243
243
  rubyforge_project:
244
- rubygems_version: 2.2.2
244
+ rubygems_version: 2.4.5
245
245
  signing_key:
246
246
  specification_version: 4
247
247
  summary: Percy::Capybara
@@ -276,3 +276,4 @@ test_files:
276
276
  - spec/lib/percy/capybara_spec.rb
277
277
  - spec/spec_helper.rb
278
278
  - spec/support/test_helpers.rb
279
+ has_rdoc: