url_attributes 1.1.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36462a136b54957f0ccfee104306510bd2b6cfe9
4
- data.tar.gz: 2ca35b51e07f1b7d1fd4adb641f1a7c9ee96edd2
3
+ metadata.gz: 72fddb96602914d4b5919991d53951949012f68b
4
+ data.tar.gz: 2a8d960c781033dd6bb95aa28b49c5fb09bcb1c5
5
5
  SHA512:
6
- metadata.gz: d3c644c91403528b321401785db681a5fc5d6e63f1a33547ea1a7ebc51d287d54d9c7a941c2b68b4c674f618a0e5ad49751dce730600541471641f420bac9134
7
- data.tar.gz: 389a2569cd9731c54631b438462ff42a0db27f67b59ebd2ccd975f96a31536921b5ef8a4edc8722ca428cc8bff65271b85d415cbd3620daff97893ee08ed266f
6
+ metadata.gz: 16c66826858d8116aefb25d0037fe5d02fe0d33d8fb9766bd08b8e9b10a5f1588f3ea4139ffbf481fab5dcaf6c6978dd2c8def635508dc3b80fed65434cff046
7
+ data.tar.gz: f7aecd99cc47f80508c12f37d07be214db148d208a7cd51cc08145786ff1483a8a61a7cbbd43ad15839b081a5e951121d69ceeb89c45f75b311967528c6b5e7d
@@ -1,19 +1,21 @@
1
- RSpec::Matchers.define :have_url_attribute do |attribute_name|
2
- # This matcher is an ugly piece of shit
3
- match do |model|
4
- model.send :"#{attribute_name}=", "notavalidurl"
5
- model.valid?
6
- test_0 = model.errors[attribute_name].include?("is not a valid URL")
7
- model.send :"#{attribute_name}=", "http://validurl.com"
8
- model.valid?
9
- test_1 = !model.errors[attribute_name].include?("is not a valid URL")
10
- model.send :"#{attribute_name}=", "nohttp.com"
11
- model.run_callbacks :save
12
- test_2 = model.send(attribute_name) == "http://nohttp.com"
13
- test_0 && test_1 && test_2
14
- end
1
+ if Rails.env.test? && defined?(RSpec)
2
+ RSpec::Matchers.define :have_url_attribute do |attribute_name|
3
+ # This matcher is an ugly piece of shit
4
+ match do |model|
5
+ model.send :"#{attribute_name}=", "notavalidurl"
6
+ model.valid?
7
+ test_0 = model.errors[attribute_name].include?("is not a valid URL")
8
+ model.send :"#{attribute_name}=", "http://validurl.com"
9
+ model.valid?
10
+ test_1 = !model.errors[attribute_name].include?("is not a valid URL")
11
+ model.send :"#{attribute_name}=", "nohttp.com"
12
+ model.run_callbacks :save
13
+ test_2 = model.send(attribute_name) == "http://nohttp.com"
14
+ test_0 && test_1 && test_2
15
+ end
15
16
 
16
- failure_message do |model|
17
- "expected that #{model} would have a URL attribute called #{attribute_name}, but it doesn't look like a URL"
17
+ failure_message do |model|
18
+ "expected that #{model} would have a URL attribute called #{attribute_name}, but it doesn't look like a URL"
19
+ end
18
20
  end
19
21
  end
@@ -1,3 +1,3 @@
1
1
  module URLAttributes
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Millo