percy-client 1.10.0 → 1.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: faeea13f560dc02b0e342b7ff1b150f1cb328992
4
- data.tar.gz: 66c65cadf25bf1f38c43d8408235aa383dd0649a
3
+ metadata.gz: 8c6c5d15e4d9aad29d9ec9f1ff5bf4f551f10caa
4
+ data.tar.gz: a177a1b2e91a815ea115b08c28961cc5139cd7f1
5
5
  SHA512:
6
- metadata.gz: c8cdecfd7259f45698e015f57b09c2f7c6800daacaea64c88ba36cf5b905220bedc98a3b5c9141743d15e651ea838f23df1742d5d76dc6884dfbe8c98b4c1c88
7
- data.tar.gz: f6c3d6f4f5fa2870c6cde224e954c297ff49b88700cbdd0417a43eadcbada8cd053d2a3aa265a6aa575e5afe019d4b7daeb826fd0eb3c6dc0bc5f5f3012e4198
6
+ metadata.gz: 730613e8ca357612b2caa17b1f09837667d6207d964576f42cd8713969436a113395b9c205c030b8619055f0709ea74cfbee1670ddfbe0f803b00e0ae708c1b1
7
+ data.tar.gz: aeb0147032f403c4874962b56d7f1782e19cfcc51348bab2e8013e567abc204f94d4eceaf9ebb6612f00a3d2256a8a147efa83eba767a36f7af1502b2f97a4a8
@@ -4,6 +4,9 @@ AllCops:
4
4
  Include:
5
5
  - Rakefile
6
6
  - lib/**/*.rake
7
+ Exclude:
8
+ - 'vendor/**/*'
9
+ - 'percy-client.gemspec'
7
10
 
8
11
  Lint/EndAlignment:
9
12
  EnforcedStyleAlignWith: variable
@@ -36,6 +39,12 @@ Style/MultilineOperationIndentation:
36
39
  Style/NumericLiterals:
37
40
  Enabled: false
38
41
 
42
+ Style/FileName:
43
+ Enabled: false
44
+
45
+ Style/SymbolArray:
46
+ Enabled: false
47
+
39
48
  Style/NumericPredicate:
40
49
  EnforcedStyle: comparison
41
50
 
@@ -58,8 +67,8 @@ Style/TrailingCommaInLiteral:
58
67
  RSpec/MessageSpies:
59
68
  EnforcedStyle: receive
60
69
 
61
-
62
-
70
+ RSpec/NotToNot:
71
+ Enabled: false
63
72
 
64
73
 
65
74
  # Will be able to do this in >= v1.11
data/Guardfile CHANGED
@@ -1,5 +1,5 @@
1
- guard :rspec, cmd: "bundle exec rspec" do
2
- require "guard/rspec/dsl"
1
+ guard :rspec, cmd: 'bundle exec rspec' do
2
+ require 'guard/rspec/dsl'
3
3
  dsl = Guard::RSpec::Dsl.new(self)
4
4
 
5
5
  # RSpec files
@@ -43,6 +43,21 @@ module Percy
43
43
  }
44
44
  end
45
45
 
46
+ def ==(other)
47
+ other.is_a?(self.class) &&
48
+ other.sha == sha &&
49
+ other.resource_url == resource_url &&
50
+ other.mimetype == mimetype
51
+ end
52
+
53
+ def hash
54
+ [sha, resource_url, mimetype].hash
55
+ end
56
+
57
+ def eql?(other)
58
+ self == other && hash == other.hash
59
+ end
60
+
46
61
  def inspect
47
62
  content_msg = content.nil? ? '' : "content.length: #{content.length}"
48
63
  "<Resource #{sha} #{resource_url} is_root:#{!!is_root} #{mimetype} #{content_msg}>"
@@ -1,5 +1,5 @@
1
1
  module Percy
2
2
  class Client
3
- VERSION = '1.10.0'.freeze
3
+ VERSION = '1.10.1'.freeze
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'percy/client/version'
@@ -8,8 +9,8 @@ Gem::Specification.new do |spec|
8
9
  spec.version = Percy::Client::VERSION
9
10
  spec.authors = ['Perceptual Inc.']
10
11
  spec.email = ['team@percy.io']
11
- spec.summary = %q{Percy::Client}
12
- spec.description = %q{}
12
+ spec.summary = 'Percy::Client'
13
+ spec.description = ''
13
14
  spec.homepage = ''
14
15
  spec.license = 'MIT'
15
16
 
@@ -1,44 +1,10 @@
1
1
  require 'digest'
2
2
 
3
+ # rubocop:disable RSpec/MultipleDescribes
3
4
  RSpec.describe Percy::Client::Resources, :vcr do
4
5
  let(:content) { "hello world! #{described_class.name}" }
5
6
  let(:sha) { Digest::SHA256.hexdigest(content) }
6
7
 
7
- describe 'Percy::Client::Resource' do
8
- it 'can be initialized with minimal data' do
9
- resource = Percy::Client::Resource.new('/foo.html', sha: sha)
10
- expect(resource.serialize).to eq(
11
- 'type' => 'resources',
12
- 'id' => sha,
13
- 'attributes' => {
14
- 'resource-url' => '/foo.html',
15
- 'mimetype' => nil,
16
- 'is-root' => nil,
17
- },
18
- )
19
- end
20
- it 'can be initialized with all data' do
21
- resource = Percy::Client::Resource.new(
22
- '/foo new.html',
23
- sha: sha,
24
- is_root: true,
25
- mimetype: 'text/html',
26
- content: content,
27
- )
28
- expect(resource.serialize).to eq(
29
- 'type' => 'resources',
30
- 'id' => sha,
31
- 'attributes' => {
32
- 'resource-url' => '/foo%20new.html',
33
- 'mimetype' => 'text/html',
34
- 'is-root' => true,
35
- },
36
- )
37
- end
38
- it 'errors if not given sha or content' do
39
- expect { Percy::Client::Resource.new('/foo.html') }.to raise_error(ArgumentError)
40
- end
41
- end
42
8
  describe '#upload_resource' do
43
9
  it 'returns true with success' do
44
10
  build = Percy.create_build('fotinakis/percy-examples')
@@ -51,3 +17,85 @@ RSpec.describe Percy::Client::Resources, :vcr do
51
17
  end
52
18
  end
53
19
  end
20
+
21
+ RSpec.describe Percy::Client::Resource do
22
+ let(:content) { "hello world! #{described_class.name}" }
23
+ let(:sha) { Digest::SHA256.hexdigest(content) }
24
+
25
+ it 'can be initialized with minimal data' do
26
+ resource = described_class.new('/foo.html', sha: sha)
27
+ expect(resource.serialize).to eq(
28
+ 'type' => 'resources',
29
+ 'id' => sha,
30
+ 'attributes' => {
31
+ 'resource-url' => '/foo.html',
32
+ 'mimetype' => nil,
33
+ 'is-root' => nil,
34
+ },
35
+ )
36
+ end
37
+ it 'can be initialized with all data' do
38
+ resource = described_class.new(
39
+ '/foo new.html',
40
+ sha: sha,
41
+ is_root: true,
42
+ mimetype: 'text/html',
43
+ content: content,
44
+ )
45
+ expect(resource.serialize).to eq(
46
+ 'type' => 'resources',
47
+ 'id' => sha,
48
+ 'attributes' => {
49
+ 'resource-url' => '/foo%20new.html',
50
+ 'mimetype' => 'text/html',
51
+ 'is-root' => true,
52
+ },
53
+ )
54
+ end
55
+ it 'errors if not given sha or content' do
56
+ expect { described_class.new('/foo.html') }.to raise_error(ArgumentError)
57
+ end
58
+
59
+ describe 'object equality' do
60
+ subject(:resource) { described_class.new('/some-content', sha: sha, mimetype: mimetype) }
61
+
62
+ let(:sha) { '123456' }
63
+ let(:mimetype) { 'text/plain' }
64
+
65
+ describe 'two resources with same properties' do
66
+ let(:other) { described_class.new('/some-content', sha: sha, mimetype: mimetype) }
67
+
68
+ it { is_expected.to eq(other) }
69
+ it { is_expected.to eql(other) }
70
+ it { expect(resource.hash).to eq(other.hash) }
71
+ it('makes their array unique') { expect([resource, other].uniq).to eq([resource]) }
72
+ end
73
+
74
+ describe 'two resources with different sha' do
75
+ let(:other) { described_class.new('/some-content', sha: sha.reverse, mimetype: mimetype) }
76
+
77
+ it { is_expected.not_to eq(other) }
78
+ it { is_expected.not_to eql(other) }
79
+ it { expect(resource.hash).not_to eq(other.hash) }
80
+ it('makes array unique') { expect([resource, other].uniq).to eq([resource, other]) }
81
+ end
82
+
83
+ describe 'two resources with different url' do
84
+ let(:other) { described_class.new('/different-content', sha: sha, mimetype: mimetype) }
85
+
86
+ it { is_expected.not_to eq(other) }
87
+ it { is_expected.not_to eql(other) }
88
+ it { expect(resource.hash).not_to eq(other.hash) }
89
+ it('makes array unique') { expect([resource, other].uniq).to eq([resource, other]) }
90
+ end
91
+
92
+ describe 'two resources with different mimetype' do
93
+ let(:other) { described_class.new('/some-content', sha: sha, mimetype: 'text/css') }
94
+
95
+ it { is_expected.not_to eq(other) }
96
+ it { is_expected.not_to eql(other) }
97
+ it { expect(resource.hash).not_to eq(other.hash) }
98
+ it('makes array unique') { expect([resource, other].uniq).to eq([resource, other]) }
99
+ end
100
+ end
101
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: percy-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.10.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: 2017-02-22 00:00:00.000000000 Z
11
+ date: 2017-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  version: '0'
189
189
  requirements: []
190
190
  rubyforge_project:
191
- rubygems_version: 2.4.8
191
+ rubygems_version: 2.6.7
192
192
  signing_key:
193
193
  specification_version: 4
194
194
  summary: Percy::Client