utensils 1.3.0 → 1.4.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: 1c733878535e6fbc196017ada0c7d944f6645698
4
- data.tar.gz: a7b38404e9e02abfaedffce8e68d5d90435c8e6f
3
+ metadata.gz: fa13c9cc6c23f59e2154c6ab07af4ced90124281
4
+ data.tar.gz: 345de22c5d7ba9fed713f4cb0f15fab326aee340
5
5
  SHA512:
6
- metadata.gz: b9594fd020088827b112a9ee2571606caaebc632f3a84d66546cd7a1a4c8f3944f56fc7c21fe43bb709b30ac8dca90d8b99e804df25b1a7ec966cac0f63de9f8
7
- data.tar.gz: 725fb5305df04218f6af6abde9b75e03d67250cfbf3ceb9b5b4e148512ee5b4f93e3ec793dec971792d171ff923b9d58e8a2a5102cd26c39593944e166010eee
6
+ metadata.gz: 7694526df301f3dc2e74ef77c3149e1031c6a33bad55a14f695df174d62cbd33dae55718327dc9bceca45ef9eb4cf80217328db5709ed465b57c5ccad4fa5b95
7
+ data.tar.gz: cf2e151022a1dfa5e4dbe9ce27f4d6b5f6211f4a524533d4ec7c611d8a310d051a4026393be596b50226f55fb082baecbc2124fe77c7a8899c8a60d7e766cfa4
data/README.md CHANGED
@@ -21,7 +21,6 @@ require 'utensils/custom_matchers'
21
21
  require 'utensils/database_cleaner'
22
22
  require 'utensils/factory_girl'
23
23
  require 'utensils/omniauth'
24
- require 'utensils/spring'
25
24
  require 'utensils/timecop'
26
25
  require 'utensils/upload_macros'
27
26
  require 'utensils/vcr'
@@ -83,10 +82,6 @@ stub_oauth_error(:facebook)
83
82
  login(user)
84
83
  ```
85
84
 
86
- ### spring
87
-
88
- Reloads factories because spring doesn't
89
-
90
85
  ### timecop
91
86
 
92
87
  Resets timecop after each spec
@@ -72,7 +72,11 @@ module Utensils
72
72
 
73
73
  def matches?(page)
74
74
  @page = page
75
- @image.is_a?(String) ? find_by_url : find_dragonfly_image
75
+ if @image.is_a?(String)
76
+ find_by_url || find_lazy_loaded_image
77
+ else
78
+ find_dragonfly_image
79
+ end
76
80
  end
77
81
 
78
82
  def failure_message
@@ -85,25 +89,29 @@ module Utensils
85
89
 
86
90
  private
87
91
 
88
- def find_by_url
89
- @page.has_css?("img[src$='#{@image}']")
90
- end
92
+ def find_by_url
93
+ @page.has_css?("img[src$='#{@image}']")
94
+ end
91
95
 
92
- def find_dragonfly_image
93
- @page.all('img').each do |img|
94
- url = img['src']
95
- dragonfly_hash = url[/media\/([^\/.]+)/, 1]
96
- if dragonfly_hash
97
- begin
98
- dragonfly_job = Dragonfly::Job.deserialize(dragonfly_hash, Dragonfly[:images])
99
- return true if dragonfly_job.uid == @image.send(:uid)
100
- rescue Dragonfly::Serializer::BadString
101
- next
96
+ def find_lazy_loaded_image
97
+ @page.has_css?("img[data-original$='#{@image}']")
98
+ end
99
+
100
+ def find_dragonfly_image
101
+ @page.all('img').each do |img|
102
+ url = img['src']
103
+ dragonfly_hash = url[/media\/([^\/.]+)/, 1]
104
+ if dragonfly_hash
105
+ begin
106
+ dragonfly_job = Dragonfly::Job.deserialize(dragonfly_hash, Dragonfly[:images])
107
+ return true if dragonfly_job.uid == @image.send(:uid)
108
+ rescue Dragonfly::Serializer::BadString
109
+ next
110
+ end
102
111
  end
103
112
  end
113
+ return false
104
114
  end
105
- return false
106
- end
107
115
  end
108
116
 
109
117
  def have_image(image_url)
@@ -1,3 +1,3 @@
1
1
  module Utensils
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utensils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Balvig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-12 00:00:00.000000000 Z
11
+ date: 2014-10-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rspec stuff we use over and over again
14
14
  email:
@@ -30,7 +30,6 @@ files:
30
30
  - lib/utensils/database_cleaner.rb
31
31
  - lib/utensils/factory_girl.rb
32
32
  - lib/utensils/omniauth.rb
33
- - lib/utensils/spring.rb
34
33
  - lib/utensils/timecop.rb
35
34
  - lib/utensils/upload_macros.rb
36
35
  - lib/utensils/vcr.rb
@@ -55,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
54
  version: '0'
56
55
  requirements: []
57
56
  rubyforge_project:
58
- rubygems_version: 2.1.0
57
+ rubygems_version: 2.2.2
59
58
  signing_key:
60
59
  specification_version: 4
61
60
  summary: Rspec stuff we use over and over again
@@ -1,5 +0,0 @@
1
- RSpec.configure do |config|
2
- config.before(:all) do
3
- FactoryGirl.reload
4
- end
5
- end