fail_fast 0.5.2 → 0.6.0
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.
- data/CHANGELOG.txt +6 -0
- data/README.markdown +16 -3
- data/fail_fast.gemspec +7 -3
- data/lib/fail_fast.rb +88 -1
- data/lib/fail_fast/base/base.rb +11 -7
- data/lib/fail_fast/base/console_utils.rb +20 -0
- data/lib/fail_fast/base/utils.rb +0 -13
- data/lib/fail_fast/error_reporter.rb +7 -0
- data/lib/fail_fast/error_reporter/base.rb +40 -0
- data/lib/fail_fast/error_reporter/hoptoad.rb +34 -0
- data/lib/fail_fast/error_reporter/hoptoad/post_error_request.xml.erb +23 -0
- data/lib/fail_fast/error_reporter/stdout.rb +9 -0
- data/lib/fail_fast/report.txt.erb +9 -4
- data/lib/fail_fast/support/error_details.rb +5 -1
- data/show_all_errors.rb +5 -5
- data/spec/{fixtures → _/fixtures}/empty.yml +0 -0
- data/spec/{fixtures → _/fixtures}/simple.yml +3 -3
- data/spec/_/support/errors.rb +13 -0
- data/spec/_/support/errors_reporters.rb +3 -0
- data/spec/_/support/hoptoad.rb +7 -0
- data/spec/_/support/it_extensions.rb +126 -0
- data/spec/_/support/stdout.rb +8 -0
- data/spec/_/support/vcr.rb +11 -0
- data/spec/_/support/webmock.rb +4 -0
- data/spec/_/support/xml.rb +4 -0
- data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_1_errors_occurs_in_1_block.yml +35 -0
- data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_2_errors_occur_in_1_block.yml +37 -0
- data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_3_errors_occur_in_2_blocks.yml +71 -0
- data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_the_API_token_is_invalid.yml +67 -0
- data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_the_API_token_is_valid.yml +35 -0
- data/spec/base/error_details_spec.rb +8 -0
- data/spec/error_reporter/fail_fast_spec.rb +73 -0
- data/spec/error_reporter/global_reporters_spec.rb +22 -0
- data/spec/error_reporter/hoptoad/expected_error_1_request.xml.erb +21 -0
- data/spec/error_reporter/hoptoad/expected_error_2_request.xml.erb +22 -0
- data/spec/error_reporter/hoptoad/hoptoad_activation_spec.rb +14 -0
- data/spec/error_reporter/hoptoad/hoptoad_requests_spec.rb +63 -0
- data/spec/error_reporter/hoptoad/hoptoad_responses_spec.rb +35 -0
- data/spec/error_reporter/stdout/stdout_spec.rb +24 -0
- data/spec/extensions/file_or_directory_exists_spec.rb +2 -2
- data/spec/extensions/has_url_spec.rb +3 -6
- data/spec/extensions/key_prefix_spec.rb +1 -1
- data/spec/how_to_use_spec.rb +1 -3
- data/spec/spec_helper.rb +13 -134
- metadata +120 -18
- data/lib/fail_fast/base/messaging.rb +0 -40
- data/lib/fail_fast/main.rb +0 -34
- data/spec/base/report_printing_spec.rb +0 -29
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
def produce_1_error_in_1_check_block
|
3
|
+
FailFast(EMPTY_FILE_PATH).check.but_fail_later do
|
4
|
+
is_on_path("azertyuiop")
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def produce_2_errors_in_1_check_block
|
9
|
+
FailFast(SIMPLE_FILE_PATH).check.but_fail_later do
|
10
|
+
has_value_for(:anykey_1, :message => 'msg-A')
|
11
|
+
has_value_for(:anykey_2, :message => 'msg-B')
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
|
2
|
+
# This fake Hoptoad api token works with the recorded vcr cassettes.
|
3
|
+
# Should you need to hit hoptoadapp.com for real, then you must
|
4
|
+
# temporarily replace it with a valid api token :
|
5
|
+
VALID_HOPTOAD_API_KEY = 'this-is-a-fake-hoptoad-api-token'
|
6
|
+
|
7
|
+
INVALID_HOPTOAD_API_KEY = '000'
|
@@ -0,0 +1,126 @@
|
|
1
|
+
|
2
|
+
module DSLMacros
|
3
|
+
module InstanceMethods
|
4
|
+
def capture_stdout
|
5
|
+
@@original_stdout = STDOUT
|
6
|
+
$stdout = StringIO.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def restore_stdout
|
10
|
+
$stdout = @@original_stdout
|
11
|
+
end
|
12
|
+
end
|
13
|
+
module ClassMethods
|
14
|
+
|
15
|
+
def it_should_return_true(msg, &block)
|
16
|
+
it "returns true #{msg}" do
|
17
|
+
capture_stdout
|
18
|
+
begin
|
19
|
+
FailFast(SIMPLE_FILE_PATH).check.but_fail_later do
|
20
|
+
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
|
21
|
+
result = self.instance_eval(&block)
|
22
|
+
#TODO : BETTER ERROR REPORTING
|
23
|
+
result.should == true
|
24
|
+
end
|
25
|
+
rescue => e
|
26
|
+
raise e
|
27
|
+
end
|
28
|
+
restore_stdout
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def it_should_return_false(msg, &block)
|
34
|
+
it "returns false #{msg}" do
|
35
|
+
capture_stdout
|
36
|
+
begin
|
37
|
+
FailFast(SIMPLE_FILE_PATH).check.but_fail_later do
|
38
|
+
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
|
39
|
+
result = self.instance_eval(&block)
|
40
|
+
#TODO : BETTER ERROR REPORTING
|
41
|
+
result.should == false
|
42
|
+
end
|
43
|
+
rescue => e
|
44
|
+
raise e
|
45
|
+
end
|
46
|
+
restore_stdout
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def it_should_not_raise_an_error(msg, &block)
|
51
|
+
it "does not raise an error #{msg}" do
|
52
|
+
capture_stdout
|
53
|
+
begin
|
54
|
+
FailFast(SIMPLE_FILE_PATH).check do
|
55
|
+
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
|
56
|
+
self.instance_eval(&block)
|
57
|
+
end
|
58
|
+
rescue => e
|
59
|
+
raise e
|
60
|
+
ensure
|
61
|
+
if FailFast.failed?
|
62
|
+
fail "ZZshould not have raised an error, but it raised\n#{FailFast.global_errors.join("\n")}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
restore_stdout
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def it_should_raise_an_error(key, kind, msg, &block)
|
70
|
+
it "raises an error #{kind}-#{key}-#{msg}" do
|
71
|
+
capture_stdout
|
72
|
+
begin
|
73
|
+
FailFast(SIMPLE_FILE_PATH).check do
|
74
|
+
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
|
75
|
+
self.instance_eval(&block)
|
76
|
+
end
|
77
|
+
rescue => e
|
78
|
+
# uncomment the next line after the refactoring/once error are no longer raise
|
79
|
+
# raise e
|
80
|
+
ensure
|
81
|
+
if !FailFast.failed?
|
82
|
+
fail "\ne2d\nshould have raised a #{kind} error for #{key} \n==#{e}"
|
83
|
+
elsif FailFast.global_errors.length == 1 && !FailFast.global_errors.first.has_key_and_kind?(key, kind)
|
84
|
+
fail "\ne2e\nshould have raised a #{kind.inspect} error for #{key.inspect}, but raised instead #{FailFast.global_errors.inspect}"
|
85
|
+
elsif 2 <= FailFast.global_errors.length
|
86
|
+
fail "\ne2f\nshould have raised only a #{kind} error for #{key}\n#{FailFast.global_errors.join("\n")}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
restore_stdout
|
90
|
+
end
|
91
|
+
end
|
92
|
+
def it_should_raise_a_direct_error(value, kind, msg, &block)
|
93
|
+
it "raises an error #{kind}-#{value}-#{msg}" do
|
94
|
+
capture_stdout
|
95
|
+
begin
|
96
|
+
FailFast(SIMPLE_FILE_PATH).check do
|
97
|
+
raise "BUG : @@errorz should be empty \n#{errors.inspect}" unless errors.empty?
|
98
|
+
self.instance_eval(&block)
|
99
|
+
end
|
100
|
+
rescue => e
|
101
|
+
# uncomment the next line after the refactoring/once error are no longer raise
|
102
|
+
# raise e
|
103
|
+
ensure
|
104
|
+
if !FailFast.failed?
|
105
|
+
fail "\ne2d\nshould have raised a #{kind} error for #{value} \n==#{e}"
|
106
|
+
elsif FailFast.global_errors.length == 1 && !FailFast.global_errors.first.has_value_and_kind?(value, kind)
|
107
|
+
fail "\ne2e\nshould have raised a #{kind.inspect} error for #{value.inspect}\n, but raised instead\n#{FailFast.global_errors.inspect}"
|
108
|
+
elsif 2 <= FailFast.global_errors.length
|
109
|
+
fail "\ne2f\nshould have raised only 1 #{kind} error for #{value}\nbut raised instead\n#{FailFast.global_errors.join("\n")}"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
restore_stdout
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.included(receiver)
|
119
|
+
receiver.extend(ClassMethods)
|
120
|
+
receiver.send :include, InstanceMethods
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
Spec::Runner.configure do |config|
|
125
|
+
config.include(DSLMacros)
|
126
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
|
3
|
+
VCR.config do |c|
|
4
|
+
c.cassette_library_dir = 'spec/_vcr_cassette_library'
|
5
|
+
c.stub_with :webmock
|
6
|
+
c.ignore_localhost = true
|
7
|
+
c.default_cassette_options = { :record => :none }
|
8
|
+
end
|
9
|
+
Spec::Runner.configure do |config|
|
10
|
+
config.extend VCR::RSpec::Macros
|
11
|
+
end
|
data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_1_errors_occurs_in_1_block.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://hoptoadapp.com:80/notifier_api/v2/notices
|
6
|
+
body: ! '<?xml version="1.0" encoding="UTF-8"?><notice version="2.0"> <api-key>this-is-a-fake-hoptoad-api-token</api-key> <notifier> <name>FailFast
|
7
|
+
Hoptoad Notifier</name> <version>0.1</version> <url>https://github.com/alainravet/fail_fast</url> </notifier> <error> <class>FailFastError</class> <message>FailFastError
|
8
|
+
at 1999-05-04 03:02:01 +0200</message> <backtrace> <line method="/Volumes/dropbox/Dropbox/dev/myos/fail_fast/spec/_/fixtures/empty.yml"
|
9
|
+
file="App not on path : ''azertyuiop''." number=''1''/> </backtrace> </error> <server-environment> <project-root>/testapp</project-root> <environment-name>test</environment-name> <app-version>1.0.0</app-version> </server-environment></notice>'
|
10
|
+
headers:
|
11
|
+
accept:
|
12
|
+
- text/xml
|
13
|
+
content-type:
|
14
|
+
- text/xml
|
15
|
+
response: !ruby/struct:VCR::Response
|
16
|
+
status: !ruby/struct:VCR::ResponseStatus
|
17
|
+
code: 200
|
18
|
+
message: OK
|
19
|
+
headers:
|
20
|
+
content-type:
|
21
|
+
- text/xml
|
22
|
+
transfer-encoding:
|
23
|
+
- chunked
|
24
|
+
status:
|
25
|
+
- '200'
|
26
|
+
x-powered-by:
|
27
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.6
|
28
|
+
x-runtime:
|
29
|
+
- '0.084877'
|
30
|
+
server:
|
31
|
+
- nginx/0.8.54 + Phusion Passenger 3.0.6 (mod_rails/mod_rack)
|
32
|
+
body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<notice>\n <error-id type=\"integer\">8252669</error-id>\n
|
33
|
+
\ <url>http://failfast.hoptoadapp.com/errors/8252669/notices/1453782749</url>\n
|
34
|
+
\ <id type=\"integer\">1453782749</id>\n</notice>\n"
|
35
|
+
http_version: '1.1'
|
data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_2_errors_occur_in_1_block.yml
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://hoptoadapp.com:80/notifier_api/v2/notices
|
6
|
+
body: <?xml version="1.0" encoding="UTF-8"?><notice version="2.0"> <api-key>this-is-a-fake-hoptoad-api-token</api-key> <notifier> <name>FailFast
|
7
|
+
Hoptoad Notifier</name> <version>0.1</version> <url>https://github.com/alainravet/fail_fast</url> </notifier> <error> <class>FailFastError</class> <message>FailFastError
|
8
|
+
at 1999-05-04 03:02:01 +0200</message> <backtrace> <line method="/Volumes/dropbox/Dropbox/dev/myos/fail_fast/spec/_/fixtures/simple.yml"
|
9
|
+
file="msg-A| Missing value for the key 'anykey_1'." number='1'/> <line
|
10
|
+
method="/Volumes/dropbox/Dropbox/dev/myos/fail_fast/spec/_/fixtures/simple.yml"
|
11
|
+
file="msg-B| Missing value for the key 'anykey_2'." number='2'/> </backtrace> </error> <server-environment> <project-root>/testapp</project-root> <environment-name>test</environment-name> <app-version>1.0.0</app-version> </server-environment></notice>
|
12
|
+
headers:
|
13
|
+
accept:
|
14
|
+
- text/xml
|
15
|
+
content-type:
|
16
|
+
- text/xml
|
17
|
+
response: !ruby/struct:VCR::Response
|
18
|
+
status: !ruby/struct:VCR::ResponseStatus
|
19
|
+
code: 200
|
20
|
+
message: OK
|
21
|
+
headers:
|
22
|
+
content-type:
|
23
|
+
- text/xml
|
24
|
+
transfer-encoding:
|
25
|
+
- chunked
|
26
|
+
status:
|
27
|
+
- '200'
|
28
|
+
x-powered-by:
|
29
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.6
|
30
|
+
x-runtime:
|
31
|
+
- '0.388047'
|
32
|
+
server:
|
33
|
+
- nginx/0.8.54 + Phusion Passenger 3.0.6 (mod_rails/mod_rack)
|
34
|
+
body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<notice>\n <error-id type=\"integer\">8259349</error-id>\n
|
35
|
+
\ <url>http://failfast.hoptoadapp.com/errors/8259349/notices/1454725873</url>\n
|
36
|
+
\ <id type=\"integer\">1454725873</id>\n</notice>\n"
|
37
|
+
http_version: '1.1'
|
data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_3_errors_occur_in_2_blocks.yml
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://hoptoadapp.com:80/notifier_api/v2/notices
|
6
|
+
body: ! '<?xml version="1.0" encoding="UTF-8"?><notice version="2.0"> <api-key>this-is-a-fake-hoptoad-api-token</api-key> <notifier> <name>FailFast
|
7
|
+
Hoptoad Notifier</name> <version>0.1</version> <url>https://github.com/alainravet/fail_fast</url> </notifier> <error> <class>FailFastError</class> <message>FailFastError
|
8
|
+
at 1999-05-04 03:02:01 +0200</message> <backtrace> <line method="/Volumes/dropbox/Dropbox/dev/myos/fail_fast/spec/_/fixtures/empty.yml"
|
9
|
+
file="App not on path : ''azertyuiop''." number=''1''/> </backtrace> </error> <server-environment> <project-root>/testapp</project-root> <environment-name>test</environment-name> <app-version>1.0.0</app-version> </server-environment></notice>'
|
10
|
+
headers:
|
11
|
+
accept:
|
12
|
+
- text/xml
|
13
|
+
content-type:
|
14
|
+
- text/xml
|
15
|
+
response: !ruby/struct:VCR::Response
|
16
|
+
status: !ruby/struct:VCR::ResponseStatus
|
17
|
+
code: 200
|
18
|
+
message: OK
|
19
|
+
headers:
|
20
|
+
content-type:
|
21
|
+
- text/xml
|
22
|
+
transfer-encoding:
|
23
|
+
- chunked
|
24
|
+
status:
|
25
|
+
- '200'
|
26
|
+
x-powered-by:
|
27
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.6
|
28
|
+
x-runtime:
|
29
|
+
- '0.061651'
|
30
|
+
server:
|
31
|
+
- nginx/0.8.54 + Phusion Passenger 3.0.6 (mod_rails/mod_rack)
|
32
|
+
body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<notice>\n <error-id type=\"integer\">8252669</error-id>\n
|
33
|
+
\ <url>http://failfast.hoptoadapp.com/errors/8252669/notices/1454739109</url>\n
|
34
|
+
\ <id type=\"integer\">1454739109</id>\n</notice>\n"
|
35
|
+
http_version: '1.1'
|
36
|
+
- !ruby/struct:VCR::HTTPInteraction
|
37
|
+
request: !ruby/struct:VCR::Request
|
38
|
+
method: :post
|
39
|
+
uri: http://hoptoadapp.com:80/notifier_api/v2/notices
|
40
|
+
body: <?xml version="1.0" encoding="UTF-8"?><notice version="2.0"> <api-key>this-is-a-fake-hoptoad-api-token</api-key> <notifier> <name>FailFast
|
41
|
+
Hoptoad Notifier</name> <version>0.1</version> <url>https://github.com/alainravet/fail_fast</url> </notifier> <error> <class>FailFastError</class> <message>FailFastError
|
42
|
+
at 1999-05-04 03:02:01 +0200</message> <backtrace> <line method="/Volumes/dropbox/Dropbox/dev/myos/fail_fast/spec/_/fixtures/simple.yml"
|
43
|
+
file="msg-A| Missing value for the key 'anykey_1'." number='1'/> <line
|
44
|
+
method="/Volumes/dropbox/Dropbox/dev/myos/fail_fast/spec/_/fixtures/simple.yml"
|
45
|
+
file="msg-B| Missing value for the key 'anykey_2'." number='2'/> </backtrace> </error> <server-environment> <project-root>/testapp</project-root> <environment-name>test</environment-name> <app-version>1.0.0</app-version> </server-environment></notice>
|
46
|
+
headers:
|
47
|
+
accept:
|
48
|
+
- text/xml
|
49
|
+
content-type:
|
50
|
+
- text/xml
|
51
|
+
response: !ruby/struct:VCR::Response
|
52
|
+
status: !ruby/struct:VCR::ResponseStatus
|
53
|
+
code: 200
|
54
|
+
message: OK
|
55
|
+
headers:
|
56
|
+
content-type:
|
57
|
+
- text/xml
|
58
|
+
transfer-encoding:
|
59
|
+
- chunked
|
60
|
+
status:
|
61
|
+
- '200'
|
62
|
+
x-powered-by:
|
63
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.6
|
64
|
+
x-runtime:
|
65
|
+
- '0.054047'
|
66
|
+
server:
|
67
|
+
- nginx/0.8.54 + Phusion Passenger 3.0.6 (mod_rails/mod_rack)
|
68
|
+
body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<notice>\n <error-id type=\"integer\">8259349</error-id>\n
|
69
|
+
\ <url>http://failfast.hoptoadapp.com/errors/8259349/notices/1454739177</url>\n
|
70
|
+
\ <id type=\"integer\">1454739177</id>\n</notice>\n"
|
71
|
+
http_version: '1.1'
|
data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_the_API_token_is_invalid.yml
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://hoptoadapp.com:80/notifier_api/v2/notices
|
6
|
+
body: ! '<?xml version="1.0" encoding="UTF-8"?><notice version="2.0"> <api-key>000</api-key> <notifier> <name>FailFast
|
7
|
+
Hoptoad Notifier</name> <version>0.1</version> <url>https://github.com/alainravet/fail_fast</url> </notifier> <error> <class>FailFastError</class> <message>FailFastError
|
8
|
+
at 1999-05-04 03:02:01 +0200</message> <backtrace> <line method="/Volumes/dropbox/Dropbox/dev/myos/fail_fast/spec/_/fixtures/empty.yml"
|
9
|
+
file="App not on path : ''azertyuiop''." number=''1''/> </backtrace> </error> <server-environment> <project-root>/testapp</project-root> <environment-name>test</environment-name> <app-version>1.0.0</app-version> </server-environment></notice>'
|
10
|
+
headers:
|
11
|
+
accept:
|
12
|
+
- text/xml
|
13
|
+
content-type:
|
14
|
+
- text/xml
|
15
|
+
response: !ruby/struct:VCR::Response
|
16
|
+
status: !ruby/struct:VCR::ResponseStatus
|
17
|
+
code: 422
|
18
|
+
message: Unprocessable Entity
|
19
|
+
headers:
|
20
|
+
content-type:
|
21
|
+
- text/xml
|
22
|
+
transfer-encoding:
|
23
|
+
- chunked
|
24
|
+
status:
|
25
|
+
- '422'
|
26
|
+
x-powered-by:
|
27
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.6
|
28
|
+
x-runtime:
|
29
|
+
- '0.014402'
|
30
|
+
server:
|
31
|
+
- nginx/0.8.54 + Phusion Passenger 3.0.6 (mod_rails/mod_rack)
|
32
|
+
body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>\n <error>No project
|
33
|
+
exists with the given API key.</error>\n</errors>\n"
|
34
|
+
http_version: '1.1'
|
35
|
+
- !ruby/struct:VCR::HTTPInteraction
|
36
|
+
request: !ruby/struct:VCR::Request
|
37
|
+
method: :post
|
38
|
+
uri: http://hoptoadapp.com:80/notifier_api/v2/notices
|
39
|
+
body: ! '<?xml version="1.0" encoding="UTF-8"?><notice version="2.0"> <api-key>000</api-key> <notifier> <name>FailFast
|
40
|
+
Hoptoad Notifier</name> <version>0.1</version> <url>https://github.com/alainravet/fail_fast</url> </notifier> <error> <class>FailFastError</class> <message>FailFastError
|
41
|
+
at 1999-05-04 03:02:01 +0200</message> <backtrace> <line method="/Volumes/dropbox/Dropbox/dev/myos/fail_fast/spec/_/fixtures/empty.yml"
|
42
|
+
file="App not on path : ''azertyuiop''." number=''1''/> </backtrace> </error> <server-environment> <project-root>/testapp</project-root> <environment-name>test</environment-name> <app-version>1.0.0</app-version> </server-environment></notice>'
|
43
|
+
headers:
|
44
|
+
accept:
|
45
|
+
- text/xml
|
46
|
+
content-type:
|
47
|
+
- text/xml
|
48
|
+
response: !ruby/struct:VCR::Response
|
49
|
+
status: !ruby/struct:VCR::ResponseStatus
|
50
|
+
code: 422
|
51
|
+
message: Unprocessable Entity
|
52
|
+
headers:
|
53
|
+
content-type:
|
54
|
+
- text/xml
|
55
|
+
transfer-encoding:
|
56
|
+
- chunked
|
57
|
+
status:
|
58
|
+
- '422'
|
59
|
+
x-powered-by:
|
60
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.6
|
61
|
+
x-runtime:
|
62
|
+
- '0.020815'
|
63
|
+
server:
|
64
|
+
- nginx/0.8.54 + Phusion Passenger 3.0.6 (mod_rails/mod_rack)
|
65
|
+
body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<errors>\n <error>No project
|
66
|
+
exists with the given API key.</error>\n</errors>\n"
|
67
|
+
http_version: '1.1'
|
data/spec/_vcr_cassette_library/FailFast_ErrorReporter_Hoptoad/when_the_API_token_is_valid.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: http://hoptoadapp.com:80/notifier_api/v2/notices
|
6
|
+
body: ! '<?xml version="1.0" encoding="UTF-8"?><notice version="2.0"> <api-key>this-is-a-fake-hoptoad-api-token</api-key> <notifier> <name>FailFast
|
7
|
+
Hoptoad Notifier</name> <version>0.1</version> <url>https://github.com/alainravet/fail_fast</url> </notifier> <error> <class>FailFastError</class> <message>FailFastError
|
8
|
+
at 1999-05-04 03:02:01 +0200</message> <backtrace> <line method="/Volumes/dropbox/Dropbox/dev/myos/fail_fast/spec/_/fixtures/empty.yml"
|
9
|
+
file="App not on path : ''azertyuiop''." number=''1''/> </backtrace> </error> <server-environment> <project-root>/testapp</project-root> <environment-name>test</environment-name> <app-version>1.0.0</app-version> </server-environment></notice>'
|
10
|
+
headers:
|
11
|
+
accept:
|
12
|
+
- text/xml
|
13
|
+
content-type:
|
14
|
+
- text/xml
|
15
|
+
response: !ruby/struct:VCR::Response
|
16
|
+
status: !ruby/struct:VCR::ResponseStatus
|
17
|
+
code: 200
|
18
|
+
message: OK
|
19
|
+
headers:
|
20
|
+
content-type:
|
21
|
+
- text/xml
|
22
|
+
transfer-encoding:
|
23
|
+
- chunked
|
24
|
+
status:
|
25
|
+
- '200'
|
26
|
+
x-powered-by:
|
27
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.6
|
28
|
+
x-runtime:
|
29
|
+
- '0.048813'
|
30
|
+
server:
|
31
|
+
- nginx/0.8.54 + Phusion Passenger 3.0.6 (mod_rails/mod_rack)
|
32
|
+
body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<notice>\n <error-id type=\"integer\">8252669</error-id>\n
|
33
|
+
\ <url>http://failfast.hoptoadapp.com/errors/8252669/notices/1454098661</url>\n
|
34
|
+
\ <id type=\"integer\">1454098661</id>\n</notice>\n"
|
35
|
+
http_version: '1.1'
|
@@ -8,4 +8,12 @@ describe FailFast::ErrorDetails do
|
|
8
8
|
its(:value ){ should == 'a_value' }
|
9
9
|
its(:message){ should == 'a_message'}
|
10
10
|
end
|
11
|
+
|
12
|
+
example "== works (bugfix)" do
|
13
|
+
e1 = FailFast::ErrorDetails.new(:a_key, :a_kind, 'a_value', 'a_message')
|
14
|
+
e1b= FailFast::ErrorDetails.new(:a_key, :a_kind, 'a_value', 'a_message')
|
15
|
+
e1.should == e1b
|
16
|
+
e2 = FailFast::ErrorDetails.new(:a_key, :a_kind, 'a_value', 'a_message'+"change")
|
17
|
+
e1.should_not == e2
|
18
|
+
end
|
11
19
|
end
|