cuke-pack 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/cuke-pack.gemspec CHANGED
@@ -19,8 +19,5 @@ Gem::Specification.new do |gem|
19
19
  gem.add_dependency 'cucumber-step_writer'
20
20
  gem.add_dependency 'thor'
21
21
  gem.add_dependency 'flay'
22
- gem.add_dependency 'hirb'
23
- gem.add_dependency 'sourcify'
24
- gem.add_dependency 'sexp_processor'
25
22
  end
26
23
 
@@ -0,0 +1,45 @@
1
+ module CukePack
2
+ class Profiles
3
+ def self.std_opts
4
+ "-r features --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} -f Cucumber::StepWriter --out features/step_definitions --strict"
5
+ end
6
+
7
+ def self.std_wip_opts
8
+ %{#{std_opts} --tags @wip}
9
+ end
10
+
11
+ def self.write
12
+ in_progress_file = 'in_progress.txt'
13
+ rerun_file = 'rerun.txt'
14
+
15
+ in_progress = nil
16
+ if File.file?(in_progress_file)
17
+ in_progress = File.readlines(in_progress_file).first
18
+
19
+ if in_progress
20
+ in_progress = nil if in_progress.empty?
21
+ end
22
+ end
23
+
24
+ if in_progress
25
+ File.open(rerun_file, 'wb') { |fh| fh.print in_progress }
26
+
27
+ wip_opts = %{RERUN_FILE=#{rerun_file} RUN_INPROGRESS=#{in_progress_file} #{std_opts} @#{rerun_file}}
28
+ else
29
+ wip_opts = %{#{std_wip_opts} features}
30
+ end
31
+
32
+ headless_driver = ENV['DRIVER'] || 'poltergeist'
33
+
34
+ headless_opts = %{DRIVER=#{headless_driver} INPROGRESS=#{in_progress_file} #{std_opts}}
35
+
36
+ <<-YML
37
+ default: #{headless_opts} features
38
+ wip: #{wip_opts}
39
+ precommit: #{headless_opts} --tags ~@no-precommit --tags ~@wip:0 features
40
+ cleanup: #{headless_opts} -f Cucumber::CleanupFormatter --out unused.txt features
41
+ YML
42
+ end
43
+ end
44
+ end
45
+
@@ -0,0 +1,49 @@
1
+ # after tests fail, re-run only failed scenarios, but one at a time so as not to oeverwhelm
2
+
3
+ in_progress = []
4
+ any_failed = false
5
+
6
+ if ENV['INPROGRESS']
7
+ File.unlink(ENV['INPROGRESS']) if File.file?(ENV['INPROGRESS'])
8
+ end
9
+
10
+ After do |s|
11
+ if s.failed?
12
+ if ENV['INPROGRESS']
13
+ in_progress << s.feature.file_colon_line(s.line)
14
+ end
15
+
16
+ if ENV['RUN_INPROGRESS']
17
+ any_failed = true
18
+ end
19
+ end
20
+ end
21
+
22
+ at_exit do
23
+ include Cucumber::Term::ANSIColor
24
+
25
+ if ENV['INPROGRESS'] and !in_progress.empty?
26
+ File.open(ENV['INPROGRESS'], 'wb') { |fh| fh.print in_progress.join("\n") }
27
+
28
+ puts red("*** Failing scenarios described in #{ENV['INPROGRESS']}. Run using the wip profile until they're fixed. ***")
29
+ end
30
+
31
+ if ENV['RUN_INPROGRESS']
32
+ if !any_failed
33
+ lines = File.readlines(ENV['RUN_INPROGRESS'])
34
+ passed = lines.shift
35
+
36
+ if lines.empty?
37
+ File.unlink(ENV['RUN_INPROGRESS'])
38
+ File.unlink(ENV['RERUN_FILE'])
39
+
40
+ puts green("*** You're done! All failed features have passed. ***")
41
+ else
42
+ File.open(ENV['RUN_INPROGRESS'], 'wb') { |fh| fh.print lines.join('') }
43
+
44
+ puts yellow("*** Still working - #{lines.length} feature#{lines.length == 1 ? '' : 's'} to go! ***")
45
+ end
46
+ end
47
+ end
48
+ end
49
+
@@ -1,5 +1,3 @@
1
- require 'sourcify'
2
-
3
1
  MAX_TIMES = 20
4
2
  WAIT_TIME = 0.1
5
3
 
@@ -39,11 +37,11 @@ class WaitingForElementFailure < StandardError
39
37
  end
40
38
 
41
39
  def message
42
- @code.to_source(:strip_enclosure => true)
40
+ @code
43
41
  end
44
42
 
45
43
  def backtrace
46
- [ @code.source_location.join(":") ]
44
+ []
47
45
  end
48
46
  end
49
47
 
@@ -1,3 +1,3 @@
1
1
  module CukePack
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,12 +1,2 @@
1
- <%
2
- std_opts = "--color -r features --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} -f Cucumber::StepWriter --out features/step_definitions --strict"
3
- %>
4
- default: <%= std_opts %> features
5
- wip: <%= std_opts %> --tags @wip features
6
- precommit: <%= std_opts %> --tags ~@wip:0 --tags ~@no-precommit features
7
-
8
- # or enable FAILFAST to have your tests end immediately on failure
9
- #precommit: FAILFAST=true <%= std_opts %> --tags ~@wip:0 features
10
-
11
- cleanup: <%= std_opts %> -f Cucumber::CleanupFormatter --out unused.txt features
1
+ <%= require 'cuke-pack/profiles' ; CukePack::Profiles.write %>
12
2
 
@@ -7,6 +7,9 @@ require 'cuke-pack/support/step_writer'
7
7
  # fail instantly if ENV['FAILFAST'] is set
8
8
  require 'cuke-pack/support/failfast'
9
9
 
10
+ # use advanced in_progress mode
11
+ require 'cuke-pack/support/in_progress'
12
+
10
13
  # set the level of flaying on the step definitions
11
14
  # set it to false to skip flaying
12
15
  flay_level = 32
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke-pack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,120 +9,72 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-25 00:00:00.000000000 Z
12
+ date: 2013-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
16
- prerelease: false
17
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
- none: false
23
22
  type: :runtime
23
+ prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
25
26
  requirements:
26
27
  - - ! '>='
27
28
  - !ruby/object:Gem::Version
28
29
  version: '0'
29
- none: false
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: cucumber-step_writer
32
- prerelease: false
33
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
37
  version: '0'
38
- none: false
39
38
  type: :runtime
39
+ prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
41
42
  requirements:
42
43
  - - ! '>='
43
44
  - !ruby/object:Gem::Version
44
45
  version: '0'
45
- none: false
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: thor
48
- prerelease: false
49
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
- none: false
55
54
  type: :runtime
55
+ prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
57
58
  requirements:
58
59
  - - ! '>='
59
60
  - !ruby/object:Gem::Version
60
61
  version: '0'
61
- none: false
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: flay
64
- prerelease: false
65
64
  requirement: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
65
  none: false
71
- type: :runtime
72
- version_requirements: !ruby/object:Gem::Requirement
73
66
  requirements:
74
67
  - - ! '>='
75
68
  - !ruby/object:Gem::Version
76
69
  version: '0'
77
- none: false
78
- - !ruby/object:Gem::Dependency
79
- name: hirb
80
- prerelease: false
81
- requirement: !ruby/object:Gem::Requirement
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- none: false
87
70
  type: :runtime
88
- version_requirements: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - ! '>='
91
- - !ruby/object:Gem::Version
92
- version: '0'
93
- none: false
94
- - !ruby/object:Gem::Dependency
95
- name: sourcify
96
71
  prerelease: false
97
- requirement: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- none: false
103
- type: :runtime
104
72
  version_requirements: !ruby/object:Gem::Requirement
105
- requirements:
106
- - - ! '>='
107
- - !ruby/object:Gem::Version
108
- version: '0'
109
- none: false
110
- - !ruby/object:Gem::Dependency
111
- name: sexp_processor
112
- prerelease: false
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
73
  none: false
119
- type: :runtime
120
- version_requirements: !ruby/object:Gem::Requirement
121
74
  requirements:
122
75
  - - ! '>='
123
76
  - !ruby/object:Gem::Version
124
77
  version: '0'
125
- none: false
126
78
  description: Stuff I use for Cucumber
127
79
  email:
128
80
  - john@coswellproductions.com
@@ -142,11 +94,13 @@ files:
142
94
  - lib/cuke-pack.rb
143
95
  - lib/cuke-pack/drivers.rb
144
96
  - lib/cuke-pack/drivers/firefox.rb
97
+ - lib/cuke-pack/profiles.rb
145
98
  - lib/cuke-pack/support/confirm_js.rb
146
99
  - lib/cuke-pack/support/expect_fields.rb
147
100
  - lib/cuke-pack/support/failfast.rb
148
101
  - lib/cuke-pack/support/fakefs.rb
149
102
  - lib/cuke-pack/support/flay.rb
103
+ - lib/cuke-pack/support/in_progress.rb
150
104
  - lib/cuke-pack/support/mocha.rb
151
105
  - lib/cuke-pack/support/pause.rb
152
106
  - lib/cuke-pack/support/pending.rb
@@ -169,20 +123,20 @@ rdoc_options: []
169
123
  require_paths:
170
124
  - lib
171
125
  required_ruby_version: !ruby/object:Gem::Requirement
126
+ none: false
172
127
  requirements:
173
128
  - - ! '>='
174
129
  - !ruby/object:Gem::Version
175
130
  version: '0'
176
- none: false
177
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
+ none: false
178
133
  requirements:
179
134
  - - ! '>='
180
135
  - !ruby/object:Gem::Version
181
136
  version: '0'
182
- none: false
183
137
  requirements: []
184
138
  rubyforge_project:
185
- rubygems_version: 1.8.24
139
+ rubygems_version: 1.8.25
186
140
  signing_key:
187
141
  specification_version: 3
188
142
  summary: Stuff I use for Cucumber