results_keeper_rspec 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/results_keeper_rspec.rb +12 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ebfbea546c247c4e427782f1fa76643adbe7ebc
4
- data.tar.gz: 616797e0680461ae6f96f6ec2623cbb1de26f6f6
3
+ metadata.gz: 21ddda9f43b3cb4709785f361b631b29bb4024d5
4
+ data.tar.gz: e8760a9fd23404b7022ddda4a5dd28a8e1b87cd8
5
5
  SHA512:
6
- metadata.gz: 2dd3b218f01b808b6443e6cc8ac63da8a89a47d66dcecfb26fd520f96a4c886aa0df0bb5a77ac0bf1a731cb62882b22ee26158f22c0c42d166f1be59fac3baaf
7
- data.tar.gz: da447dc30810ba95d6ac58b077aeaff3a0b856e345a3bb0069129b4906960e07738eee17e76bbcc7974e924f5df4e208db87a171fc4633ab9e349e66bea7331d
6
+ metadata.gz: f111e527660fc379db52318053772ab955d7ce8447b777ab4d3b886f75d617ae5b7a57e4999db48cb3498bb2f98a2c4215b5f7854c0d87b44b2429cc1cb5cc7d
7
+ data.tar.gz: 2224cbcc2f95bd7abd93d3d147c7c46caf0228ce4588a82cb018af4663ecfe2a68e5cf33ce5b2ac3b3705d009c004df8c738ab92a837bae929ea9114fedfca3b
@@ -27,7 +27,8 @@ class ResultsKeeperRspec
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
  status = scenario.exception ? 'failed' : 'passed'
32
33
  scenario_error = scenario.exception.message if scenario.exception
33
34
  run_path = "rspec #{scenario.location}"
@@ -40,7 +41,16 @@ class ResultsKeeperRspec
40
41
  revision_id: @revision['revision_id']
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_rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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