hot_or_not 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -17,3 +17,4 @@ gem 'rest-client', '~> 1.6.1'
17
17
  gem 'diffy', '~> 2.0.1'
18
18
  gem 'facets', '~> 2.9.1'
19
19
  gem 'json', '~> 1.5.2'
20
+ gem 'hpricot', '~> 0.8.4'
data/Gemfile.lock CHANGED
@@ -4,6 +4,7 @@ GEM
4
4
  diffy (2.0.1)
5
5
  facets (2.9.1)
6
6
  git (1.2.5)
7
+ hpricot (0.8.4)
7
8
  jeweler (1.6.0)
8
9
  bundler (~> 1.0.0)
9
10
  git (>= 1.2.5)
@@ -27,6 +28,7 @@ DEPENDENCIES
27
28
  bundler (~> 1.0.0)
28
29
  diffy (~> 2.0.1)
29
30
  facets (~> 2.9.1)
31
+ hpricot (~> 0.8.4)
30
32
  jeweler (~> 1.6.0)
31
33
  json (~> 1.5.2)
32
34
  mocha
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -61,8 +61,9 @@ module HotOrNot
61
61
  def body_by_content_type(result)
62
62
  case result.headers[:content_type]
63
63
  when /json/i
64
- json = JSON.parse(result.body).sort
65
- JSON.pretty_generate json
64
+ JSON.pretty_generate JSON.parse(result.body).sort
65
+ when /html/i
66
+ @compare_url.options[:selector] ? Hpricot(result.body).search(@compare_url.options[:selector]).to_html : result.body
66
67
  else
67
68
  result.body
68
69
  end
data/lib/hot_or_not.rb CHANGED
@@ -5,6 +5,7 @@ require 'rest-client'
5
5
  require 'diffy'
6
6
  require 'yaml'
7
7
  require 'facets'
8
+ require 'hpricot'
8
9
 
9
10
  Dir.glob(File.dirname(__FILE__) + '/hot_or_not/ext/*.rb').each { |f| require f }
10
11
  Dir.glob(File.dirname(__FILE__) + '/hot_or_not/**/*.rb').each { |f| require f }
@@ -50,6 +50,23 @@ module HotOrNot
50
50
  assert @result.success?
51
51
  end
52
52
  end
53
+
54
+ context "inside of a selector" do
55
+ setup do
56
+ compare_url = CompareUrl.new 'Test People', '/api/people', 'http://side_a', 'http://side_b', :selector => 'div#content'
57
+ body_a = "<div>foo</div><div id='content'>foo</div>"
58
+ body_b = "<div>bar</div><div id='content'>foo</div>"
59
+ response_a = FakeResponse.new body_a, 200
60
+ response_b = FakeResponse.new body_b, 200
61
+ side_a_results = UrlResult.new compare_url.side_a, response_a, nil
62
+ side_b_results = UrlResult.new compare_url.side_b, response_b, nil
63
+ @result = ComparisonResult.new compare_url, side_a_results, side_b_results
64
+ end
65
+
66
+ should "return success" do
67
+ assert @result.success?
68
+ end
69
+ end
53
70
  end
54
71
 
55
72
  context "when results don't match" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot_or_not
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joel Friedman
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-29 00:00:00 -05:00
18
+ date: 2011-07-14 00:00:00 -05:00
19
19
  default_executable: hot_or_not
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -83,8 +83,24 @@ dependencies:
83
83
  prerelease: false
84
84
  version_requirements: *id004
85
85
  - !ruby/object:Gem::Dependency
86
- name: shoulda
86
+ name: hpricot
87
87
  requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ hash: 55
93
+ segments:
94
+ - 0
95
+ - 8
96
+ - 4
97
+ version: 0.8.4
98
+ type: :runtime
99
+ prerelease: false
100
+ version_requirements: *id005
101
+ - !ruby/object:Gem::Dependency
102
+ name: shoulda
103
+ requirement: &id006 !ruby/object:Gem::Requirement
88
104
  none: false
89
105
  requirements:
90
106
  - - ">="
@@ -95,10 +111,10 @@ dependencies:
95
111
  version: "0"
96
112
  type: :development
97
113
  prerelease: false
98
- version_requirements: *id005
114
+ version_requirements: *id006
99
115
  - !ruby/object:Gem::Dependency
100
116
  name: bundler
101
- requirement: &id006 !ruby/object:Gem::Requirement
117
+ requirement: &id007 !ruby/object:Gem::Requirement
102
118
  none: false
103
119
  requirements:
104
120
  - - ~>
@@ -111,10 +127,10 @@ dependencies:
111
127
  version: 1.0.0
112
128
  type: :development
113
129
  prerelease: false
114
- version_requirements: *id006
130
+ version_requirements: *id007
115
131
  - !ruby/object:Gem::Dependency
116
132
  name: jeweler
117
- requirement: &id007 !ruby/object:Gem::Requirement
133
+ requirement: &id008 !ruby/object:Gem::Requirement
118
134
  none: false
119
135
  requirements:
120
136
  - - ~>
@@ -127,10 +143,10 @@ dependencies:
127
143
  version: 1.6.0
128
144
  type: :development
129
145
  prerelease: false
130
- version_requirements: *id007
146
+ version_requirements: *id008
131
147
  - !ruby/object:Gem::Dependency
132
148
  name: rcov
133
- requirement: &id008 !ruby/object:Gem::Requirement
149
+ requirement: &id009 !ruby/object:Gem::Requirement
134
150
  none: false
135
151
  requirements:
136
152
  - - ">="
@@ -141,10 +157,10 @@ dependencies:
141
157
  version: "0"
142
158
  type: :development
143
159
  prerelease: false
144
- version_requirements: *id008
160
+ version_requirements: *id009
145
161
  - !ruby/object:Gem::Dependency
146
162
  name: mocha
147
- requirement: &id009 !ruby/object:Gem::Requirement
163
+ requirement: &id010 !ruby/object:Gem::Requirement
148
164
  none: false
149
165
  requirements:
150
166
  - - ">="
@@ -155,7 +171,7 @@ dependencies:
155
171
  version: "0"
156
172
  type: :development
157
173
  prerelease: false
158
- version_requirements: *id009
174
+ version_requirements: *id010
159
175
  description: Run this with a new version of your site comparing to current version to verify no break changes are made to your api's
160
176
  email: asher.friedman@gmail.com
161
177
  executables: