spinach 0.8.5 → 0.8.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 436e1db0c9e03682091f476cbb0609302a009a5e
4
- data.tar.gz: d92085e255eb9576a950bb3f3cb0568b7bc37d66
3
+ metadata.gz: 8b06366576529fde1142d11caeb3d9c776d504d0
4
+ data.tar.gz: 53b4b5148bad2619d3c2da56cbd6cd564dc19903
5
5
  SHA512:
6
- metadata.gz: f18bfc39fa9df149ca059408b34c92110c174ce243bd17e47b1991e43cb67c2d0134b4eca6677289b171c5318e784ca3a530d20bbcd549b94db908d601ff284c
7
- data.tar.gz: 5945739d165eea692bd980ab2de66f284c613779afe21dac4fcf6a30a0a2104ce37e131526592596732a1c0612f4ae8bdf3080b2d5a651ae3f85cb5a07d1f4ae
6
+ metadata.gz: 91664558827b59436634ae1c7dcef6d3ba014ddb4ce3de5ca06f05f126b32d6fc5c9efefb55608a870df81c36b9ef4a5f54933f3c542ed0a3423c9d3deb31b65
7
+ data.tar.gz: 04d2886162de7a8d8fccee73ccf9690b4d80e6053b7eb94e83766db0558339e6d30d18eef42d9d8a127b9c2dd17b6f2afd1a3c326b3b79e780cc3309e6f2cd62
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.8.6
2
+ * add total run time after each run
3
+ * fixed #145: Issue with step autoloading
4
+
1
5
  == 0.8.4
2
6
  * fixed #138: The pending steps should abort the remaining scenario, but continue running other scenarios
3
7
  * added the feature #140: Allow blockless step definitions
data/Gemfile CHANGED
@@ -12,6 +12,7 @@ group :test do
12
12
  gem 'guard-spinach'
13
13
  gem 'capybara', '~> 2.0.0'
14
14
  gem "rspec"
15
+ gem 'fakefs'
15
16
  end
16
17
 
17
18
  group :darwin do
@@ -27,6 +27,7 @@ module Spinach
27
27
  # Hooks the reporter to the runner endpoints
28
28
  def bind
29
29
  Spinach.hooks.tap do |hooks|
30
+ hooks.before_run { |*args| before_run(*args) }
30
31
  hooks.after_run { |*args| after_run(*args) }
31
32
  hooks.before_feature { |*args| before_feature_run(*args) }
32
33
  hooks.after_feature { |*args| after_feature_run(*args) }
@@ -48,6 +49,7 @@ module Spinach
48
49
  end
49
50
  end
50
51
 
52
+ def before_run(*args); end;
51
53
  def after_run(*args); end;
52
54
  def before_feature_run(*args); end
53
55
  def after_feature_run(*args); end
@@ -41,7 +41,7 @@ module Spinach
41
41
  def report_pending_steps
42
42
  if pending_steps.any?
43
43
  error.puts "\nPending steps summary:\n"
44
- report_errors('Pending steps', pending_steps, :yellow)
44
+ report_errors('Pending steps', pending_steps, :yellow)
45
45
  end
46
46
  end
47
47
 
@@ -195,6 +195,10 @@ module Spinach
195
195
  buffer.join
196
196
  end
197
197
 
198
+ def before_run(*)
199
+ @start_time = Time.now
200
+ end
201
+
198
202
  # It prints the error summary if the run has failed
199
203
  # It always print feature success summary
200
204
  #
@@ -217,6 +221,7 @@ module Spinach
217
221
  error_summary = format_summary(:red, error_steps, 'Error')
218
222
 
219
223
  out.puts "Steps Summary: #{successful_summary}, #{undefined_summary}, #{pending_summary}, #{failed_summary}, #{error_summary}\n\n"
224
+ out.puts "Finished in #{Time.now - @start_time} seconds" if @start_time
220
225
  end
221
226
  end
222
227
  end
@@ -99,6 +99,7 @@ module Spinach
99
99
  require_relative 'frameworks'
100
100
  end
101
101
 
102
+ # Returns an array of files to be required. Sorted by the most nested files first, then alphabetically.
102
103
  # @return [Array<String>] files
103
104
  # The step definition files.
104
105
  #
@@ -106,7 +107,7 @@ module Spinach
106
107
  def step_definition_files
107
108
  Dir.glob(
108
109
  File.expand_path File.join(step_definitions_path, '**', '*.rb')
109
- )
110
+ ).sort{|a,b| [b.count(File::SEPARATOR), a] <=> [a.count(File::SEPARATOR), b]}
110
111
  end
111
112
 
112
113
  # Returns an array of support files inside the support_path. Will
@@ -1,4 +1,4 @@
1
1
  module Spinach
2
2
  # Spinach version.
3
- VERSION = "0.8.5"
3
+ VERSION = "0.8.6"
4
4
  end
data/spinach.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.description = %q{Spinach is a BDD framework on top of gherkin}
9
9
  gem.summary = %q{Spinach is a BDD framework on top of gherkin}
10
10
  gem.homepage = "http://github.com/codegram/spinach"
11
- gem.license = 'MIT (Expat)'
11
+ gem.license = 'MIT'
12
12
 
13
13
  gem.add_runtime_dependency 'gherkin-ruby', '~> 0.3.0'
14
14
  gem.add_runtime_dependency 'colorize', '0.5.8'
@@ -57,6 +57,11 @@ module Spinach
57
57
  Spinach.hooks.reset
58
58
  end
59
59
 
60
+ it "binds a callback before running" do
61
+ @reporter.expects(:before_run)
62
+ Spinach.hooks.run_before_run
63
+ end
64
+
60
65
  it "binds a callback after running" do
61
66
  @reporter.expects(:after_run)
62
67
  Spinach.hooks.run_after_run
@@ -144,12 +144,23 @@ describe Spinach::Runner do
144
144
  end
145
145
 
146
146
  describe '#required_files' do
147
+ it 'requires the most deeply nested files first, then alphabetically' do
148
+ FakeFS do
149
+ FileUtils.mkdir_p('features/steps/a')
150
+ FileUtils.mkdir_p('features/steps/z')
151
+ ['features/steps/a.rb', 'features/steps/a/a.rb', 'features/steps/z.rb', 'features/steps/z/z.rb'].each do |f|
152
+ FileUtils.touch(f)
153
+ end
154
+ runner.required_files.must_equal(['features/steps/a/a.rb', 'features/steps/z/z.rb', 'features/steps/a.rb', 'features/steps/z.rb'])
155
+ end
156
+ end
157
+
147
158
  it 'requires environment files first' do
148
159
  runner.stubs(:step_definition_path).returns('steps')
149
160
  runner.stubs(:support_path).returns('support')
150
161
  Dir.stubs(:glob).returns(['/support/bar.rb', '/support/env.rb', '/support/quz.rb'])
151
- runner.stubs(:step_definition_files).returns(['/steps/bar.feature'])
152
- runner.required_files.must_equal(['/support/env.rb', '/support/bar.rb', '/support/quz.rb', '/steps/bar.feature'])
162
+ runner.stubs(:step_definition_files).returns(['/steps/bar.rb'])
163
+ runner.required_files.must_equal(['/support/env.rb', '/support/bar.rb', '/support/quz.rb', '/steps/bar.rb'])
153
164
  end
154
165
  end
155
166
 
data/test/test_helper.rb CHANGED
@@ -17,6 +17,7 @@ require 'mocha/setup'
17
17
  require 'ostruct'
18
18
  require 'stringio'
19
19
  require 'pry'
20
+ require 'fakefs/safe'
20
21
 
21
22
  require 'spinach'
22
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spinach
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-07-27 00:00:00.000000000 Z
14
+ date: 2013-09-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gherkin-ruby
@@ -276,7 +276,7 @@ files:
276
276
  - test/test_helper.rb
277
277
  homepage: http://github.com/codegram/spinach
278
278
  licenses:
279
- - MIT (Expat)
279
+ - MIT
280
280
  metadata: {}
281
281
  post_install_message:
282
282
  rdoc_options: []
@@ -363,3 +363,4 @@ test_files:
363
363
  - test/spinach_test.rb
364
364
  - test/support/filesystem.rb
365
365
  - test/test_helper.rb
366
+ has_rdoc: