results_keeper 0.0.7 → 0.0.9

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/results_keeper.rb +12 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4ddd3800830ca92ea6245df0d5f95762e851510
4
- data.tar.gz: 4f89e4c14bd98a496e01e5958b3d034fd6b83846
3
+ metadata.gz: ba80ee58c10530c0f02d4784ff6ca426f220e835
4
+ data.tar.gz: 7249b6a447c7ecce098aaaba91efbb992a977c81
5
5
  SHA512:
6
- metadata.gz: 4e0449500d612e08e1d88d9f63efca4121f1e64759669c5845d1bacb37c5236d472dcf8e5c11cc24f5557f83a1cedc56b9c0a44dc5985603c4607c3d1f360557
7
- data.tar.gz: ae727d4202cb2631e70c69fd76a467558e78a0eb2cba88dfd16887e9f65c07e5c4ece3cfd530c719b86ddca07c8bc0c23f7c2ea9bf711f7406c2921f3fb1175f
6
+ metadata.gz: 01dec0c5c1db79fafd6af94130e9085591a0d6bdc401f7a40390d8e47ac9dbd31c010b7b26ec17bce2bd8404ac671d93f5c254bde8440a295fd69f15728cd4a1
7
+ data.tar.gz: 01d02173e389bf8eba4ebca1a2789202270cad5def7a7f8930e5fbffe9be5f8814698ffdd9c7ed058e9ace2be8465f76185deecb74167e9dd5c8676a5b976952
@@ -27,7 +27,8 @@ class ResultsKeeper
27
27
  send_json(data, 'revisions')
28
28
  end
29
29
 
30
- def send_test(scenario, screenshot_path=nil)
30
+ def send_test(scenario)
31
+ @screenshot_path = save_screenshot(scenario) if ENV['SEND_SCREENSHOT']
31
32
  scenario_steps = scenario.test_steps.map(&:name) unless ENV['NO_STEPS']
32
33
  scenario_error = scenario.exception.message if scenario.exception
33
34
  run_path = "cucumber #{scenario.location.file}:#{scenario.location.line}"
@@ -40,7 +41,16 @@ class ResultsKeeper
40
41
  steps: scenario_steps
41
42
  }
42
43
  @test = send_json(data, 'tests')
43
- send_screenshot(screenshot_path) if screenshot_path
44
+ send_screenshot(@screenshot_path) if @screenshot_path
45
+ end
46
+
47
+ def save_screenshot(scenario)
48
+ if scenario.exception
49
+ screenshot_name = "#{Time.now.to_i}_#{rand(1000..9999)}.png"
50
+ @file_path = "tmp/screenshots/#{screenshot_name}"
51
+ Capybara.page.save_screenshot(@file_path)
52
+ @file_path
53
+ end
44
54
  end
45
55
 
46
56
  def send_json(body, path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: results_keeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kozakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-08 00:00:00.000000000 Z
11
+ date: 2016-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flickraw