percy-capybara 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +130 -0
- data/lib/percy/capybara/loaders/sprockets_loader.rb +7 -3
- data/lib/percy/capybara/version.rb +1 -1
- data/spec/lib/percy/capybara/client/testdata/assets/css/digested-f3420c6aee71c137a3ca39727052811bae84b2f37d898f4db242e20656a1579e.css +1 -0
- data/spec/lib/percy/capybara/client/testdata/css/digested.css +1 -0
- data/spec/lib/percy/capybara/loaders/sprockets_loader_spec.rb +28 -6
- metadata +8 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6498403c9a10399a29d67eafa17d576300d62fa1
|
|
4
|
+
data.tar.gz: 5159d6ff409edac2d447b71990050b46b235f6e8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24ca4f78314dbfd15f3575b1199a56713c79b11909b863e9e932cfe1c11e3ef3bf6111e50b6f49100f35949b4498eab23055a2bc930ffab8e2db08bab4064123
|
|
7
|
+
data.tar.gz: 57f2014995d9afc020debf852b4f0829c9b20564c8a831f22c257f43e7ab550d7b6fee9955000fb36cb91645585c7919197ee9a839cc4d42b1bcfacde07ce88e
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
percy-capybara (2.1.1)
|
|
5
|
+
percy-client (~> 1.4)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
addressable (2.4.0)
|
|
11
|
+
capybara (2.6.2)
|
|
12
|
+
addressable
|
|
13
|
+
mime-types (>= 1.16)
|
|
14
|
+
nokogiri (>= 1.3.3)
|
|
15
|
+
rack (>= 1.0.0)
|
|
16
|
+
rack-test (>= 0.5.4)
|
|
17
|
+
xpath (~> 2.0)
|
|
18
|
+
capybara-webkit (1.8.0)
|
|
19
|
+
capybara (>= 2.3.0, < 2.7.0)
|
|
20
|
+
json
|
|
21
|
+
childprocess (0.5.9)
|
|
22
|
+
ffi (~> 1.0, >= 1.0.11)
|
|
23
|
+
coderay (1.1.0)
|
|
24
|
+
concurrent-ruby (1.0.0)
|
|
25
|
+
crack (0.4.3)
|
|
26
|
+
safe_yaml (~> 1.0.0)
|
|
27
|
+
diff-lcs (1.2.5)
|
|
28
|
+
faraday (0.9.2)
|
|
29
|
+
multipart-post (>= 1.2, < 3)
|
|
30
|
+
ffi (1.9.10)
|
|
31
|
+
formatador (0.2.5)
|
|
32
|
+
guard (2.13.0)
|
|
33
|
+
formatador (>= 0.2.4)
|
|
34
|
+
listen (>= 2.7, <= 4.0)
|
|
35
|
+
lumberjack (~> 1.0)
|
|
36
|
+
nenv (~> 0.1)
|
|
37
|
+
notiffany (~> 0.0)
|
|
38
|
+
pry (>= 0.9.12)
|
|
39
|
+
shellany (~> 0.0)
|
|
40
|
+
thor (>= 0.18.1)
|
|
41
|
+
guard-compat (1.2.1)
|
|
42
|
+
guard-rspec (4.6.4)
|
|
43
|
+
guard (~> 2.1)
|
|
44
|
+
guard-compat (~> 1.1)
|
|
45
|
+
rspec (>= 2.99.0, < 4.0)
|
|
46
|
+
hashdiff (0.2.3)
|
|
47
|
+
httpclient (2.8.0)
|
|
48
|
+
json (1.8.3)
|
|
49
|
+
listen (3.0.6)
|
|
50
|
+
rb-fsevent (>= 0.9.3)
|
|
51
|
+
rb-inotify (>= 0.9.7)
|
|
52
|
+
lumberjack (1.0.10)
|
|
53
|
+
method_source (0.8.2)
|
|
54
|
+
mime-types (2.99)
|
|
55
|
+
mini_portile2 (2.0.0)
|
|
56
|
+
multi_json (1.11.2)
|
|
57
|
+
multipart-post (2.0.0)
|
|
58
|
+
nenv (0.3.0)
|
|
59
|
+
nokogiri (1.6.7.2)
|
|
60
|
+
mini_portile2 (~> 2.0.0.rc2)
|
|
61
|
+
notiffany (0.0.8)
|
|
62
|
+
nenv (~> 0.1)
|
|
63
|
+
shellany (~> 0.0)
|
|
64
|
+
percy-client (1.4.1)
|
|
65
|
+
faraday (>= 0.9)
|
|
66
|
+
httpclient (>= 2.6)
|
|
67
|
+
pry (0.10.3)
|
|
68
|
+
coderay (~> 1.1.0)
|
|
69
|
+
method_source (~> 0.8.1)
|
|
70
|
+
slop (~> 3.4)
|
|
71
|
+
rack (1.6.4)
|
|
72
|
+
rack-test (0.6.3)
|
|
73
|
+
rack (>= 1.0)
|
|
74
|
+
rake (10.5.0)
|
|
75
|
+
rb-fsevent (0.9.7)
|
|
76
|
+
rb-inotify (0.9.7)
|
|
77
|
+
ffi (>= 0.5.0)
|
|
78
|
+
rspec (3.4.0)
|
|
79
|
+
rspec-core (~> 3.4.0)
|
|
80
|
+
rspec-expectations (~> 3.4.0)
|
|
81
|
+
rspec-mocks (~> 3.4.0)
|
|
82
|
+
rspec-core (3.4.2)
|
|
83
|
+
rspec-support (~> 3.4.0)
|
|
84
|
+
rspec-expectations (3.4.0)
|
|
85
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
86
|
+
rspec-support (~> 3.4.0)
|
|
87
|
+
rspec-mocks (3.4.1)
|
|
88
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
89
|
+
rspec-support (~> 3.4.0)
|
|
90
|
+
rspec-support (3.4.1)
|
|
91
|
+
rubyzip (1.1.7)
|
|
92
|
+
safe_yaml (1.0.4)
|
|
93
|
+
selenium-webdriver (2.51.0)
|
|
94
|
+
childprocess (~> 0.5)
|
|
95
|
+
multi_json (~> 1.0)
|
|
96
|
+
rubyzip (~> 1.0)
|
|
97
|
+
websocket (~> 1.0)
|
|
98
|
+
shellany (0.0.1)
|
|
99
|
+
slop (3.6.0)
|
|
100
|
+
sprockets (3.5.2)
|
|
101
|
+
concurrent-ruby (~> 1.0)
|
|
102
|
+
rack (> 1, < 3)
|
|
103
|
+
thor (0.19.1)
|
|
104
|
+
webmock (1.22.6)
|
|
105
|
+
addressable (>= 2.3.6)
|
|
106
|
+
crack (>= 0.3.2)
|
|
107
|
+
hashdiff
|
|
108
|
+
websocket (1.2.2)
|
|
109
|
+
xpath (2.0.0)
|
|
110
|
+
nokogiri (~> 1.3)
|
|
111
|
+
|
|
112
|
+
PLATFORMS
|
|
113
|
+
ruby
|
|
114
|
+
|
|
115
|
+
DEPENDENCIES
|
|
116
|
+
bundler (~> 1.7)
|
|
117
|
+
capybara (~> 2.4)
|
|
118
|
+
capybara-webkit (>= 1.6)
|
|
119
|
+
faraday (>= 0.8)
|
|
120
|
+
guard-rspec
|
|
121
|
+
mime-types (< 3)
|
|
122
|
+
percy-capybara!
|
|
123
|
+
rake (~> 10.0)
|
|
124
|
+
rspec (~> 3.2)
|
|
125
|
+
selenium-webdriver
|
|
126
|
+
sprockets (>= 3.2.0)
|
|
127
|
+
webmock (~> 1)
|
|
128
|
+
|
|
129
|
+
BUNDLED WITH
|
|
130
|
+
1.10.6
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'percy/capybara/loaders/base_loader'
|
|
2
2
|
require 'digest'
|
|
3
3
|
require 'find'
|
|
4
|
+
require 'set'
|
|
4
5
|
require 'uri'
|
|
5
6
|
|
|
6
7
|
module Percy
|
|
@@ -13,7 +14,6 @@ module Percy
|
|
|
13
14
|
attr_reader :sprockets_options
|
|
14
15
|
|
|
15
16
|
SKIP_RESOURCE_EXTENSIONS = [
|
|
16
|
-
'.js', # Ignore JavaScript.
|
|
17
17
|
'.map', # Ignore source maps.
|
|
18
18
|
]
|
|
19
19
|
|
|
@@ -31,6 +31,7 @@ module Percy
|
|
|
31
31
|
|
|
32
32
|
def build_resources
|
|
33
33
|
resources = []
|
|
34
|
+
loaded_resource_urls = Set.new
|
|
34
35
|
|
|
35
36
|
# Load resources from the asset pipeline.
|
|
36
37
|
_asset_logical_paths.each do |logical_path|
|
|
@@ -51,6 +52,8 @@ module Percy
|
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
next if SKIP_RESOURCE_EXTENSIONS.include?(File.extname(resource_url))
|
|
55
|
+
|
|
56
|
+
loaded_resource_urls.add(resource_url)
|
|
54
57
|
resources << Percy::Client::Resource.new(resource_url, sha: sha, content: content)
|
|
55
58
|
end
|
|
56
59
|
|
|
@@ -68,11 +71,12 @@ module Percy
|
|
|
68
71
|
# of the app.
|
|
69
72
|
resource_url = path.sub(public_path, '')
|
|
70
73
|
|
|
71
|
-
|
|
74
|
+
# Skip precompiled files already included via the asset pipeline.
|
|
75
|
+
next if loaded_resource_urls.include?(resource_url)
|
|
72
76
|
|
|
77
|
+
sha = Digest::SHA256.hexdigest(File.read(path))
|
|
73
78
|
resources << Percy::Client::Resource.new(resource_url, sha: sha, path: path)
|
|
74
79
|
end
|
|
75
|
-
|
|
76
80
|
end
|
|
77
81
|
|
|
78
82
|
resources
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-- Do not change this, these contents generate a specific digested filename for testing. --
|
|
@@ -20,10 +20,13 @@ RSpec.describe Percy::Capybara::Loaders::SprocketsLoader do
|
|
|
20
20
|
environment.append_path '.'
|
|
21
21
|
environment
|
|
22
22
|
end
|
|
23
|
+
let(:digest_enabled) { false }
|
|
23
24
|
let(:sprockets_options) do
|
|
24
25
|
options = double('options')
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
# Set specific files we want to compile. In normal use, this would be all CSS and JS files.
|
|
27
|
+
precompile_list = [/(?:\/|\\|\A)(base|digested)\.(css|js)$|\.map/]
|
|
28
|
+
allow(options).to receive(:precompile).and_return(precompile_list)
|
|
29
|
+
allow(options).to receive(:digest).and_return(digest_enabled)
|
|
27
30
|
options
|
|
28
31
|
end
|
|
29
32
|
|
|
@@ -52,22 +55,41 @@ RSpec.describe Percy::Capybara::Loaders::SprocketsLoader do
|
|
|
52
55
|
describe '#build_resources', type: :feature do
|
|
53
56
|
it 'returns "build resources" from filtered sprockets paths' do
|
|
54
57
|
resources = loader.build_resources
|
|
55
|
-
|
|
58
|
+
expected_resources = [
|
|
59
|
+
'/assets/css/base.css',
|
|
60
|
+
'/assets/css/digested.css',
|
|
61
|
+
'/assets/js/base.js',
|
|
62
|
+
]
|
|
63
|
+
expect(resources.map { |r| r.resource_url }).to eq(expected_resources)
|
|
56
64
|
expect(resources.first.content).to include('.colored-by-base')
|
|
57
65
|
end
|
|
58
66
|
context 'Rails app' do
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
before(:each) do
|
|
61
68
|
# Pretend like we're in a Rails app right now, all we care about is Rails.public_path.
|
|
62
69
|
rails_double = double('Rails')
|
|
63
70
|
# Pretend like the entire testdata directory is the public/ folder.
|
|
64
71
|
expect(rails_double).to receive(:public_path).and_return(environment.root)
|
|
65
72
|
expect(loader).to receive(:_rails).at_least(:once).and_return(rails_double)
|
|
66
|
-
|
|
73
|
+
end
|
|
74
|
+
it 'includes files from the public folder (non-asset-pipeline)' do
|
|
67
75
|
resources = loader.build_resources
|
|
68
76
|
expect(resources.length).to be > 5 # Weak test that more things are in this list.
|
|
69
77
|
expect(resources.map { |r| r.resource_url }).to include('/images/percy.svg')
|
|
70
78
|
end
|
|
79
|
+
context 'digest enabled' do
|
|
80
|
+
let(:digest_enabled) { true }
|
|
81
|
+
|
|
82
|
+
it 'only includes pre-compiled, digested files once' do
|
|
83
|
+
# This makes sure that we correctly merge already-compiled files in the assets directory
|
|
84
|
+
# with ones from the asset pipeline. This means that Rails users who have
|
|
85
|
+
# `config.assets.digest = true` set can safely run "rake assets:precompile" before tests.
|
|
86
|
+
resources = loader.build_resources
|
|
87
|
+
expected_digest_url = \
|
|
88
|
+
'/assets/css/digested-f3420c6aee71c137a3ca39727052811bae84b2f37d898f4db242e20656a1579e.css'
|
|
89
|
+
digested_resources = resources.select { |r| r.resource_url == expected_digest_url }
|
|
90
|
+
expect(digested_resources.length).to eq(1)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
71
93
|
end
|
|
72
94
|
end
|
|
73
95
|
end
|
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.1.
|
|
4
|
+
version: 2.1.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-05-
|
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: percy-client
|
|
@@ -176,6 +176,7 @@ files:
|
|
|
176
176
|
- ".travis.yml"
|
|
177
177
|
- ".yardopts"
|
|
178
178
|
- Gemfile
|
|
179
|
+
- Gemfile.lock
|
|
179
180
|
- Guardfile
|
|
180
181
|
- LICENSE
|
|
181
182
|
- README.md
|
|
@@ -193,7 +194,9 @@ files:
|
|
|
193
194
|
- percy-capybara.gemspec
|
|
194
195
|
- spec/lib/percy/capybara/client/builds_spec.rb
|
|
195
196
|
- spec/lib/percy/capybara/client/snapshots_spec.rb
|
|
197
|
+
- spec/lib/percy/capybara/client/testdata/assets/css/digested-f3420c6aee71c137a3ca39727052811bae84b2f37d898f4db242e20656a1579e.css
|
|
196
198
|
- spec/lib/percy/capybara/client/testdata/css/base.css
|
|
199
|
+
- spec/lib/percy/capybara/client/testdata/css/digested.css
|
|
197
200
|
- spec/lib/percy/capybara/client/testdata/css/imports.css
|
|
198
201
|
- spec/lib/percy/capybara/client/testdata/css/level0-imports.css
|
|
199
202
|
- spec/lib/percy/capybara/client/testdata/css/level1-imports.css
|
|
@@ -241,14 +244,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
241
244
|
version: '0'
|
|
242
245
|
requirements: []
|
|
243
246
|
rubyforge_project:
|
|
244
|
-
rubygems_version: 2.
|
|
247
|
+
rubygems_version: 2.2.2
|
|
245
248
|
signing_key:
|
|
246
249
|
specification_version: 4
|
|
247
250
|
summary: Percy::Capybara
|
|
248
251
|
test_files:
|
|
249
252
|
- spec/lib/percy/capybara/client/builds_spec.rb
|
|
250
253
|
- spec/lib/percy/capybara/client/snapshots_spec.rb
|
|
254
|
+
- spec/lib/percy/capybara/client/testdata/assets/css/digested-f3420c6aee71c137a3ca39727052811bae84b2f37d898f4db242e20656a1579e.css
|
|
251
255
|
- spec/lib/percy/capybara/client/testdata/css/base.css
|
|
256
|
+
- spec/lib/percy/capybara/client/testdata/css/digested.css
|
|
252
257
|
- spec/lib/percy/capybara/client/testdata/css/imports.css
|
|
253
258
|
- spec/lib/percy/capybara/client/testdata/css/level0-imports.css
|
|
254
259
|
- spec/lib/percy/capybara/client/testdata/css/level1-imports.css
|
|
@@ -276,4 +281,3 @@ test_files:
|
|
|
276
281
|
- spec/lib/percy/capybara_spec.rb
|
|
277
282
|
- spec/spec_helper.rb
|
|
278
283
|
- spec/support/test_helpers.rb
|
|
279
|
-
has_rdoc:
|