percy-capybara 2.0.1 → 2.1.0

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: 9bbb4516a98285f5ed9b0b812adcef690b8686e0
4
- data.tar.gz: ddb0cbdd5e8bf72ebd8db055d58785b544d2832e
3
+ metadata.gz: 8ec1811094152205c30db1c67c183b14e85d3a52
4
+ data.tar.gz: 039f35ab33a64b6b14d0d3328da291a824b9e0c1
5
5
  SHA512:
6
- metadata.gz: d120cbf4e1617f544a021775ca87dc9f4ff791474ca557cb63dd7d68a69e8514409b2e82e3c00a4be56d0e077bd53fabe4a7715cb1bb4dc7991362abb5aa4a0c
7
- data.tar.gz: 39349c21063c63c6958e0917478155f272e0f7e60208e1972c990a8a7b96e20561f2b98bfcee68ed9aa3cbecf026fcdcbd3fc89cdf02e6d597bbe4c4413960f5
6
+ metadata.gz: acd5e2f499016bbcf3e9fcd1321d2a601258117ba275553dc600502dfb32a13dffe8c9ad6189748738562d37372df781586f5472aec6c071a1e0dca1139fba7b
7
+ data.tar.gz: d3ec4106d244bdffb26f7a79506e42b291df27a92e4f53f939835f117cba4e3e95105c9f4f0a6e4f1dd3da249608b882865d79ed5bc4d70cdaa8a9a963077df4
@@ -41,8 +41,16 @@ module Percy
41
41
  end
42
42
 
43
43
  # Reset the global Percy::Capybara module state.
44
- def self.reset
44
+ def self.reset!
45
45
  @capybara_client = nil
46
46
  end
47
+ # The 'reset' method is deprecated and will be removed: use the reset! method instead.
48
+ class << self; alias_method :reset, :reset!; end;
49
+
50
+ # Manually disable Percy for the current capybara client. This can also be done with the
51
+ # PERCY_ENABLE=0 environment variable.
52
+ def self.disable!
53
+ capybara_client.disable!
54
+ end
47
55
  end
48
56
  end
@@ -38,6 +38,10 @@ module Percy
38
38
  @enabled ||= !Percy::Client::Environment.current_ci.nil?
39
39
  end
40
40
 
41
+ def disable!
42
+ @enabled = false
43
+ end
44
+
41
45
  def rescue_connection_failures(&block)
42
46
  raise ArgumentError.new('block is requried') if !block_given?
43
47
  begin
@@ -1,5 +1,5 @@
1
1
  module Percy
2
2
  module Capybara
3
- VERSION = '2.0.1'
3
+ VERSION = '2.1.0'
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  RSpec.describe Percy::Capybara do
2
2
  before(:each) do
3
- Percy::Capybara.reset
3
+ Percy::Capybara.reset!
4
4
  @original_env = ENV['TRAVIS_BUILD_ID']
5
5
  ENV['PERCY_ENABLE'] = '1'
6
6
  ENV['TRAVIS_BUILD_ID'] = nil
@@ -61,11 +61,19 @@ RSpec.describe Percy::Capybara do
61
61
  Percy::Capybara.finalize_build
62
62
  end
63
63
  end
64
- describe '#reset' do
64
+ describe '#reset!' do
65
65
  it 'clears the current capybara_client' do
66
66
  capybara_client = Percy::Capybara.capybara_client
67
- Percy::Capybara.reset
67
+ Percy::Capybara.reset!
68
68
  expect(Percy::Capybara.capybara_client).to_not eq(capybara_client)
69
69
  end
70
70
  end
71
+ describe '#disable!' do
72
+ it 'sets the current capybara_client to disabled' do
73
+ capybara_client = Percy::Capybara.capybara_client
74
+ expect(Percy::Capybara.capybara_client.enabled?).to eq(true)
75
+ Percy::Capybara.disable!
76
+ expect(Percy::Capybara.capybara_client.enabled?).to eq(false)
77
+ end
78
+ end
71
79
  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.0.1
4
+ version: 2.1.0
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-03-10 00:00:00.000000000 Z
11
+ date: 2016-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: percy-client