crashbreak 1.0.15 → 1.0.16
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 +4 -4
- data/lib/crashbreak/version.rb +1 -1
- data/lib/restorers/state_restorer.rb +1 -1
- data/lib/tasks/crashbreak.rake +11 -0
- data/spec/restorers/state_restorer_spec.rb +11 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 090bcc725aec72a06594ff7adc7c3020c8e012bb
|
4
|
+
data.tar.gz: a08df3d75839a074aa6010089b8f10fc5136a385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a83cafd9c89d262e5d2ddfad9df7df6d0a49012cb985d07bffdadcfc0ede6d2837027a32ebef0ffc548e3e1a94444792aafeb9f37e3048bd833d72769a67e8a
|
7
|
+
data.tar.gz: f28fdeebfd0d8f5bed1a5c79a3d8c824c34b2f4b7804dc9dd13a394744cc1bb1258597f31cc254da8b34081be5fc81f8b6d223d8756009004f3701fe0c0f4c2f
|
data/lib/crashbreak/version.rb
CHANGED
data/lib/tasks/crashbreak.rake
CHANGED
@@ -41,6 +41,17 @@ namespace :crashbreak do
|
|
41
41
|
|
42
42
|
system("bundle exec rspec #{Crashbreak.configurator.request_spec_file_path}") or raise 'Crashbreak test failed.'
|
43
43
|
end
|
44
|
+
|
45
|
+
task generate_test: :environment do
|
46
|
+
test_path = "#{Crashbreak.project_root}/#{Crashbreak.configurator.request_spec_file_path}"
|
47
|
+
|
48
|
+
if File.exist?(test_path)
|
49
|
+
next puts 'Crashbreak test already exist, remove it first and retry.'
|
50
|
+
end
|
51
|
+
|
52
|
+
template = File.read(Crashbreak.configurator.request_spec_template_path).gsub('<%= error_id %>', ENV['error_id'])
|
53
|
+
File.open(test_path, 'w+') {|file| file.write(template)}
|
54
|
+
end
|
44
55
|
end
|
45
56
|
|
46
57
|
class CrashbreakTestError < StandardError
|
@@ -10,25 +10,27 @@ describe Crashbreak::StateRestorer do
|
|
10
10
|
to_return(status: 200, body: dumpers_data.to_json)
|
11
11
|
end
|
12
12
|
|
13
|
-
let(:dumpers_data) { Hash['TestDumper' => { test_key: 'test_data' } ] }
|
13
|
+
let(:dumpers_data) { Hash['Crashbreak::TestDumper' => { test_key: 'test_data' } ] }
|
14
14
|
|
15
15
|
it 'returns a hash with all restorers data' do
|
16
|
-
expect_any_instance_of(TestRestorer).to receive(:initialize)
|
16
|
+
expect_any_instance_of(Crashbreak::TestRestorer).to receive(:initialize)
|
17
17
|
expect(subject.restore).to eq(test: 'restored_test_data')
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'passes dumper data with error id to restorer' do
|
21
|
-
expect_any_instance_of(TestRestorer).to receive(:initialize).with('test_key' => 'test_data', 'error_id' => error_id)
|
21
|
+
expect_any_instance_of(Crashbreak::TestRestorer).to receive(:initialize).with('test_key' => 'test_data', 'error_id' => error_id)
|
22
22
|
subject.restore
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
module Crashbreak
|
27
|
+
class TestRestorer
|
28
|
+
def initialize(data)
|
29
|
+
@data = data
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
32
|
+
def restore
|
33
|
+
'restored_test_data'
|
34
|
+
end
|
33
35
|
end
|
34
36
|
end
|