gurke 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e85f846008f8a50b146bf69dca846d1e7fd57549
4
- data.tar.gz: 71265a8d33673e0df171d924be526d98aef0d2cd
3
+ metadata.gz: ba96b511b63ade3b7846428a3af7a09c643b3551
4
+ data.tar.gz: 21cf019e6773067c52d53327865ecbb135a60e36
5
5
  SHA512:
6
- metadata.gz: 0c010846e3ed562d0bd1c1c52abdd47c0b38e27b35913de6c4490898baee435cd3c7149483e810831c762651586b7170a883c818042b0636da63925358014259
7
- data.tar.gz: ff7a64e2be4a0086c3a569d1c80150c07da7b1404725d9119487a37e9a8967735c3db821f2fd9091a70481aa8bf33f9c248060ccaea8ac25b26d06c7bf66cb0b
6
+ metadata.gz: 9d798023595db4dcf3b64bd1d6b93ff1644acea4b87493304100abf3c81ae0ab148648a157ef44923f4b968976421b8be3d8f19f9d8851b39687d1fcd1ba2463
7
+ data.tar.gz: 3d438d0bd1bcf5a065f7afb3c2755350038a64eb9417204c2b00bd25e38221ff615038846857a14f41f04e47d5ef92d94052c4564ae76b4ca97cc1791ef0f2e8
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'gurke'
7
- spec.version = '1.0.0'
7
+ spec.version = '1.0.1'
8
8
  spec.authors = ['Jan Graichen']
9
9
  spec.email = %w(jg@altimos.de)
10
10
  spec.description = %q{A description}
@@ -1,6 +1,6 @@
1
1
  module Gurke
2
2
  class Current
3
- attr_accessor :scenario, :step
3
+ attr_accessor :scenario, :step, :feature
4
4
 
5
5
  class << self
6
6
  def instance
@@ -11,6 +11,10 @@ module Gurke
11
11
  instance.scenario
12
12
  end
13
13
 
14
+ def feature
15
+ instance.feature
16
+ end
17
+
14
18
  def step
15
19
  instance.step
16
20
  end
@@ -24,6 +28,10 @@ module Gurke
24
28
  def before_step(step)
25
29
  Current.instance.step = step
26
30
  end
31
+
32
+ def before_feature(feature)
33
+ Current.instance.feature = feature
34
+ end
27
35
  end
28
36
 
29
37
  ::Gurke::Formatter.use Formatter
@@ -17,6 +17,8 @@ module Gurke
17
17
  end
18
18
  end
19
19
 
20
+ at_exit { invoke :after, :all }
21
+
20
22
  self.class.instance = self
21
23
  end
22
24
 
@@ -31,6 +33,7 @@ module Gurke
31
33
  ## -- Before callbacks --
32
34
 
33
35
  def before_features(features)
36
+ invoke :before, :all
34
37
  invoke :before, :features, [features]
35
38
  end
36
39
 
@@ -97,7 +100,7 @@ module Gurke
97
100
 
98
101
  def after_feature_element(element)
99
102
  invoke :after, :feature_element, [element]
100
- invoke :before, :scenario, args: [element]
103
+ invoke :after, :scenario, args: [element]
101
104
  end
102
105
 
103
106
  def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
@@ -7,6 +7,10 @@ module Gurke
7
7
  @main, @options = main, options
8
8
  end
9
9
 
10
+ def current
11
+ Gurke.current
12
+ end
13
+
10
14
  class << self
11
15
  def gurkig?
12
16
  true
@@ -23,7 +23,7 @@ module Gurke
23
23
  end
24
24
 
25
25
  def dir
26
- File.mkdir
26
+ options[:dir] || 'report/recoding'
27
27
  end
28
28
 
29
29
  def recording?
@@ -47,6 +47,13 @@ module Gurke
47
47
  # TODO: Dir / Template / Whatever - just test atm
48
48
  end
49
49
 
50
+ def before_feature(feature)
51
+ dir = File.join(self.dir.to_s, feature.short_name.to_s)
52
+
53
+ FileUtils.rm_rf dir if File.exists? dir
54
+ FileUtils.mkdir_p dir
55
+ end
56
+
50
57
  # -- Intercept scenarios --
51
58
 
52
59
  def before_feature_element(scenario)
@@ -59,14 +66,17 @@ module Gurke
59
66
  if recording?
60
67
  if scenario.failed? || record_all?
61
68
  # TODO: Dir / Template / Whatever - just test atm
62
- file = File.join('report', "#{scenario.name}.flv")
69
+
70
+ file = File.join(dir, (current.feature.short_name || 'nil'), (scenario.name || 'nil'), 'video.webm')
71
+ FileUtils.mkdir_p File.dirname file
72
+
63
73
  @headless.video.stop_and_save file
64
74
  else
65
75
  @headless.video.stop_and_discard
66
76
  end
67
77
  end
68
78
 
69
- # TODO: Dir / Template / Whatever - just test atm
79
+ @index = 0
70
80
  end
71
81
 
72
82
  # -- Intercept steps --
@@ -87,10 +97,11 @@ module Gurke
87
97
  def take_sceenshot(step)
88
98
  return if step.background?
89
99
 
90
- filename = "#{step.keyword}#{step.name}".downcase.gsub(/[^A-z0-9]+/, '_')
91
-
92
100
  # TODO: Dir / Template / Whatever - just test atm
93
- @headless.take_screenshot "report/#{@index += 1}_#{filename}.png"
101
+ file = File.join(dir, current.feature.short_name, current.scenario.name, "#{@index += 1} - #{step.keyword}#{step.name}.png")
102
+
103
+ FileUtils.mkdir_p File.dirname file
104
+ @headless.take_screenshot "'#{file.gsub("'", "\\'")}'"
94
105
  end
95
106
  end
96
107
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gurke
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-04 00:00:00.000000000 Z
11
+ date: 2014-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: A description
@@ -73,7 +73,7 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
76
+ - ".gitignore"
77
77
  - Gemfile
78
78
  - LICENSE.txt
79
79
  - README.md
@@ -96,17 +96,17 @@ require_paths:
96
96
  - lib
97
97
  required_ruby_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - '>='
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - '>='
104
+ - - ">="
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.1.11
109
+ rubygems_version: 2.2.1
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: A summary