hot_or_not 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/hot_or_not/comparison_result.rb +10 -3
- data/test/comparison_result_test.rb +17 -0
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
@@ -13,14 +13,14 @@ module HotOrNot
|
|
13
13
|
|
14
14
|
def initialize(compare_url, side_a_results, side_b_results)
|
15
15
|
@compare_url, @side_a_results, @side_b_results = compare_url, side_a_results, side_b_results
|
16
|
-
@message
|
16
|
+
@message = ''
|
17
17
|
init_message unless success?
|
18
18
|
end
|
19
19
|
|
20
20
|
def success?
|
21
21
|
!error? &&
|
22
22
|
@side_a_results.code == @side_b_results.code &&
|
23
|
-
|
23
|
+
!different?
|
24
24
|
end
|
25
25
|
|
26
26
|
def error?
|
@@ -39,6 +39,11 @@ module HotOrNot
|
|
39
39
|
@diff.to_s format
|
40
40
|
end
|
41
41
|
|
42
|
+
def different?
|
43
|
+
return side_a_body != side_b_body if @diff.nil?
|
44
|
+
@diff.count > 1
|
45
|
+
end
|
46
|
+
|
42
47
|
def output_to_files_in(directory)
|
43
48
|
write_to directory, "side_a", side_a_body
|
44
49
|
write_to directory, "side_b", side_b_body
|
@@ -53,7 +58,9 @@ module HotOrNot
|
|
53
58
|
message += "#{$/} #{@compare_url.base_b} => #{@side_b_results.error_message}" if @side_b_results.error?
|
54
59
|
message
|
55
60
|
else
|
56
|
-
|
61
|
+
diff_options = '-U 3'
|
62
|
+
diff_options += ' ' + @compare_url.options[:diff] if @compare_url.options[:diff]
|
63
|
+
@diff = Diffy::Diff.new(side_a_body, side_b_body, :diff => diff_options)
|
57
64
|
"#{@compare_url.full_name}: #{@compare_url.url}: Body from #{@compare_url.base_a} did not match body from #{@compare_url.base_b}"
|
58
65
|
end
|
59
66
|
end
|
@@ -67,6 +67,23 @@ module HotOrNot
|
|
67
67
|
assert @result.success?
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
context "ignoring whitespace" do
|
72
|
+
setup do
|
73
|
+
compare_url = CompareUrl.new 'Test People', '/api/people', 'http://side_a', 'http://side_b', :diff => '-w'
|
74
|
+
body_a = "foo"
|
75
|
+
body_b = " foo"
|
76
|
+
response_a = FakeResponse.new body_a, 200
|
77
|
+
response_b = FakeResponse.new body_b, 200
|
78
|
+
side_a_results = UrlResult.new compare_url.side_a, response_a, nil
|
79
|
+
side_b_results = UrlResult.new compare_url.side_b, response_b, nil
|
80
|
+
@result = ComparisonResult.new compare_url, side_a_results, side_b_results
|
81
|
+
end
|
82
|
+
|
83
|
+
should "return success" do
|
84
|
+
assert @result.success?
|
85
|
+
end
|
86
|
+
end
|
70
87
|
end
|
71
88
|
|
72
89
|
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:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
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-07-
|
18
|
+
date: 2011-07-18 00:00:00 -05:00
|
19
19
|
default_executable: hot_or_not
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|