spinach 0.8.9 → 0.8.10

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: 8c1f5d14fd17c664d04af5c26331b5ebdffd68d6
4
- data.tar.gz: 516f1ca8cd7a2e5e63c9cdbfe805668c196e2e37
3
+ metadata.gz: 2b29833b6efaa67b23b899ac116da0ed43893b03
4
+ data.tar.gz: 47d838646bd2e30584f00bcf0a8366d0771175f3
5
5
  SHA512:
6
- metadata.gz: 217336b4e2db284a25387fb5fb6fc4906913992879d8fd25f51ff5f2abf35b060b9789e9450e664751d187fb274f4decf1a21814cb328491e1c3ffc61b2e88e5
7
- data.tar.gz: 9d21d91f3894fedda12acbec8761a39dfa02d59a52fec3d5e28d58b6d845b30684c0ab1a6cbe8f997d9a4f09ee27c8356a52315a390221e7d004b8934fc072e1
6
+ metadata.gz: 1ec7dd33eb6f1ee1013f9d99002586b002edfa8191b2f2494d73a22183325b8bf350dd8ef8639022d45a01c902d1f4ffa2ca3a40d52eac573c7a20c095404c9a
7
+ data.tar.gz: dbac7af642bff3cfb2899b7713de5f6d1974b9ab7e375b219eb30422e5f2ff508954b2c0a50308eb7425e53f5c014467aa12668d67029e7a5ae9fc6069460b6d
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.2
@@ -1,7 +1,9 @@
1
1
  rvm:
2
2
  - 1.9.3
3
3
  - 2.0.0
4
- - 2.1.0
5
- - rbx
4
+ - 2.1.2
5
+ - rbx-2.2.7
6
+ - jruby-19mode
6
7
 
7
8
  cache: bundler
9
+ script: "bundle exec rake"
data/Gemfile CHANGED
@@ -3,16 +3,12 @@ source 'http://rubygems.org'
3
3
  # Specify your gem's dependencies in spinach.gemspec
4
4
  gemspec
5
5
 
6
- gem 'rake'
7
6
  gem 'coveralls', require: false
8
7
 
9
8
  group :test do
10
9
  gem 'guard'
11
10
  gem 'guard-minitest'
12
11
  gem 'guard-spinach'
13
- gem 'capybara'
14
- gem "rspec"
15
- gem 'fakefs'
16
12
  end
17
13
 
18
14
  group :darwin do
@@ -1,6 +1,6 @@
1
- # Spinach - BDD framework on top of Gherkin
1
+ # Spinach - BDD framework on top of Gherkin
2
2
  [![Gem Version](https://badge.fury.io/rb/spinach.png)](http://badge.fury.io/rb/spinach)
3
- [![Build Status](https://secure.travis-ci.org/codegram/spinach.png)](http://travis-ci.org/codegram/spinach)
3
+ [![Build Status](https://secure.travis-ci.org/codegram/spinach.png)](http://travis-ci.org/codegram/spinach)
4
4
  [![Dependency Status](https://gemnasium.com/codegram/spinach.png)](http://gemnasium.com/codegram/spinach)
5
5
  [![Coverage Status](https://coveralls.io/repos/codegram/spinach/badge.png?branch=master)](https://coveralls.io/r/codegram/spinach)
6
6
 
@@ -18,7 +18,8 @@ Conceived as an alternative to Cucumber, here are some of its design goals:
18
18
  * Step reusability: In case you want to reuse steps across features, you can
19
19
  always wrap those in plain ol' Ruby modules.
20
20
 
21
- Spinach is tested against **MRI 1.9.3 and 2.0.0**.
21
+ Spinach is tested against **MRI 1.9.3, 2.0 and 2.1** as well as **JRuby 1.7+**
22
+ and **Rubinius 2.2+**.
22
23
 
23
24
  We are not planning to make it compatible with MRI 1.8.7 since, you know, this
24
25
  would be irresponsible :)
@@ -168,7 +169,7 @@ This is one way to make that reusable:
168
169
  module CommonSteps
169
170
  module Login
170
171
  include Spinach::DSL
171
-
172
+
172
173
  step 'I am logged in' do
173
174
  # log in stuff...
174
175
  end
@@ -287,7 +288,7 @@ class Spinach::Features::SessionTimeout < Spinach::FeatureSteps
287
288
  after do
288
289
  change_session_timeout_to original_timeout_value
289
290
  end
290
-
291
+
291
292
  # remaining steps
292
293
  end
293
294
  ```
@@ -17,10 +17,10 @@ class ExitStatus < Spinach::FeatureSteps
17
17
  end
18
18
 
19
19
  Then "the exit status should be 0" do
20
- @last_exit_status.must_equal 0
20
+ @last_exit_status.success?.must_equal true
21
21
  end
22
22
 
23
23
  Then "the exit status should be 1" do
24
- @last_exit_status.must_equal 1
24
+ @last_exit_status.success?.must_equal false
25
25
  end
26
26
  end
@@ -1,3 +1,4 @@
1
+ require 'minitest/autorun'
1
2
  require 'minitest/spec'
2
3
  require_relative 'filesystem'
3
4
 
@@ -80,7 +80,7 @@ module Integration
80
80
  def failure_step
81
81
  %Q|class AFailureFeature < Spinach::FeatureSteps
82
82
  feature "A failure feature"
83
- %{failure_step_definition}
83
+ #{failure_step_definition}
84
84
  |
85
85
  end
86
86
 
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'open3'
2
3
 
3
4
  # The Filesystem module runs commands, captures their output and exit status
4
5
  # and lets the host know about it.
@@ -49,26 +50,12 @@ module Filesystem
49
50
  # @api public
50
51
  def run(command)
51
52
  in_current_dir do
52
- # stdout, stderr pipes
53
- rout, wout = IO.pipe
54
- rerr, werr = IO.pipe
55
-
56
- pid = Process.spawn(command, :out => wout, :err => werr)
57
- _, status = Process.wait2(pid)
58
-
59
- # close write ends so we could read them
60
- wout.close
61
- werr.close
62
-
63
- @stdout = rout.readlines.join("\n").force_encoding('utf-8')
64
- @stderr = rerr.readlines.join("\n").force_encoding('utf-8')
65
-
66
- # dispose the read ends of the pipes
67
- rout.close
68
- rerr.close
69
-
70
- @last_exit_status = status.exitstatus
53
+ args = command.strip.split(" ")
54
+ @stdout, @stderr, @last_exit_status = Open3.capture3(*args)
71
55
  end
56
+
57
+ @stdout = strip_colors(@stdout)
58
+ @stderr = strip_colors(@stderr)
72
59
  end
73
60
 
74
61
  private
@@ -89,4 +76,7 @@ module Filesystem
89
76
  ['tmp/fs']
90
77
  end
91
78
 
79
+ def strip_colors(string)
80
+ string.gsub(/\e\[((\d;?)+)m/, "")
81
+ end
92
82
  end
@@ -15,11 +15,12 @@ module Integration
15
15
  end
16
16
  end
17
17
 
18
- def run_feature(command, options={})
18
+ def run_feature(feature, options={})
19
19
  options[:framework] ||= :minitest
20
20
  use_minitest if options[:framework] == :minitest
21
21
  use_rspec if options[:framework] == :rspec
22
- run "#{ruby} ../../bin/spinach #{command} #{options[:append]}"
22
+ spinach = File.expand_path("bin/spinach")
23
+ run "#{ruby} #{spinach} #{feature} #{options[:append]}"
23
24
  end
24
25
 
25
26
  def ruby
@@ -59,7 +59,7 @@ module Spinach
59
59
  end
60
60
  elsif File.directory?(arg)
61
61
  files_to_run << Dir.glob(File.join(arg, '**', '*.feature'))
62
- else
62
+ elsif arg != "{}"
63
63
  fail! "invalid argument - #{arg}"
64
64
  end
65
65
  end
@@ -1,6 +1,6 @@
1
1
  module Spinach
2
2
  class Feature
3
- attr_accessor :line
3
+ attr_accessor :filename, :line
4
4
  attr_accessor :name, :scenarios, :tags
5
5
  attr_accessor :background
6
6
  attr_accessor :description
@@ -14,5 +14,8 @@ module Spinach
14
14
  @background.nil? ? [] : @background.steps
15
15
  end
16
16
 
17
+ def line=(value)
18
+ @line = value.to_i if value
19
+ end
17
20
  end
18
21
  end
@@ -73,6 +73,8 @@ module Spinach
73
73
  filename.split(':')
74
74
  end.each do |filename, line|
75
75
  feature = Parser.open_file(filename).parse
76
+ feature.filename = filename
77
+ feature.line = line
76
78
  success = FeatureRunner.new(feature, line).run
77
79
  successful = false unless success
78
80
  break if fail_fast? && !successful
@@ -1,4 +1,4 @@
1
1
  module Spinach
2
2
  # Spinach version.
3
- VERSION = "0.8.9"
3
+ VERSION = "0.8.10"
4
4
  end
@@ -10,17 +10,18 @@ Gem::Specification.new do |gem|
10
10
  gem.homepage = "http://github.com/codegram/spinach"
11
11
  gem.license = 'MIT'
12
12
 
13
- gem.add_runtime_dependency 'gherkin-ruby', '>= 0.3.1'
14
- gem.add_runtime_dependency 'colorize', '0.5.8'
13
+ gem.add_runtime_dependency 'gherkin-ruby', '>= 0.3.2'
14
+ gem.add_runtime_dependency 'colorize'
15
15
  gem.add_runtime_dependency 'json'
16
16
  gem.add_development_dependency 'rake'
17
- gem.add_development_dependency 'mocha'
17
+ gem.add_development_dependency 'mocha', '~> 1.0'
18
18
  gem.add_development_dependency 'sinatra'
19
19
  gem.add_development_dependency 'capybara'
20
20
  gem.add_development_dependency 'pry'
21
21
  gem.add_development_dependency 'simplecov'
22
22
  gem.add_development_dependency 'rspec'
23
- gem.add_development_dependency 'minitest'
23
+ gem.add_development_dependency 'minitest', '< 5.0'
24
+ gem.add_development_dependency 'fakefs', ">= 0.5.2"
24
25
 
25
26
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
27
  gem.files = `git ls-files`.split("\n")
@@ -228,7 +228,7 @@ tags:
228
228
  end
229
229
  end
230
230
 
231
- describe 'it fails if the feature does not exist' do
231
+ it 'it fails if the feature does not exist' do
232
232
  cli = Spinach::Cli.new(['features/some_feature.feature'])
233
233
  File.stubs(:exists?).returns(false)
234
234
  cli.expects(:fail!).with('features/some_feature.feature could not be found')
@@ -76,7 +76,7 @@ describe Spinach::Runner do
76
76
  @feature_runner = stub
77
77
  filenames.each do |filename|
78
78
  Spinach::Parser.stubs(:open_file).with(filename).returns parser = stub
79
- parser.stubs(:parse).returns feature = stub
79
+ parser.stubs(:parse).returns feature = Spinach::Feature.new
80
80
  Spinach::Runner::FeatureRunner.stubs(:new).
81
81
  with(feature, anything).
82
82
  returns(@feature_runner)
@@ -101,13 +101,35 @@ describe Spinach::Runner do
101
101
  runner.run.must_equal false
102
102
  end
103
103
 
104
+ describe 'when line set' do
105
+ let(:filename) { 'features/cool_feature.feature' }
106
+ let(:line) { 12 }
107
+ let(:filenames) { ["#{filename}:#{line}"] }
108
+ let(:runner) { Spinach::Runner.new(filenames) }
109
+
110
+ it 'sets filename and line on the feature' do
111
+ @feature_runner = stub
112
+ Spinach::Parser.stubs(:open_file).with(filename).returns parser = stub
113
+ parser.stubs(:parse).returns feature = Spinach::Feature.new
114
+ Spinach::Runner::FeatureRunner.stubs(:new).
115
+ with(feature, anything).
116
+ returns(@feature_runner)
117
+ runner.stubs(required_files: [])
118
+ @feature_runner.stubs(:run).returns(true)
119
+
120
+ runner.run.must_equal true
121
+ feature.filename.must_equal filename
122
+ feature.line.must_equal line
123
+ end
124
+ end
125
+
104
126
  describe "when fail_fast set" do
105
127
  let(:feature_runners) { [ stub, stub ] }
106
128
 
107
129
  before(:each) do
108
130
  filenames.each_with_index do |filename, i|
109
131
  Spinach::Parser.stubs(:open_file).with(filename).returns parser = stub
110
- parser.stubs(:parse).returns feature = stub
132
+ parser.stubs(:parse).returns feature = Spinach::Feature.new
111
133
  Spinach::Runner::FeatureRunner.stubs(:new).
112
134
  with(feature, anything).
113
135
  returns(feature_runners[i])
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  require 'minitest/autorun'
15
15
  require 'minitest/spec'
16
- require 'mocha/setup'
16
+ require 'mocha/mini_test'
17
17
  require 'ostruct'
18
18
  require 'stringio'
19
19
  require 'pry'
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.9
4
+ version: 0.8.10
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: 2014-04-14 00:00:00.000000000 Z
14
+ date: 2014-07-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gherkin-ruby
@@ -19,28 +19,28 @@ dependencies:
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.3.1
22
+ version: 0.3.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.3.1
29
+ version: 0.3.2
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: colorize
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - '='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 0.5.8
36
+ version: '0'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - '='
41
+ - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 0.5.8
43
+ version: '0'
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: json
46
46
  requirement: !ruby/object:Gem::Requirement
@@ -73,16 +73,16 @@ dependencies:
73
73
  name: mocha
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ">="
76
+ - - "~>"
77
77
  - !ruby/object:Gem::Version
78
- version: '0'
78
+ version: '1.0'
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - ">="
83
+ - - "~>"
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: '1.0'
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: sinatra
88
88
  requirement: !ruby/object:Gem::Requirement
@@ -155,18 +155,32 @@ dependencies:
155
155
  version: '0'
156
156
  - !ruby/object:Gem::Dependency
157
157
  name: minitest
158
+ requirement: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - "<"
161
+ - !ruby/object:Gem::Version
162
+ version: '5.0'
163
+ type: :development
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - "<"
168
+ - !ruby/object:Gem::Version
169
+ version: '5.0'
170
+ - !ruby/object:Gem::Dependency
171
+ name: fakefs
158
172
  requirement: !ruby/object:Gem::Requirement
159
173
  requirements:
160
174
  - - ">="
161
175
  - !ruby/object:Gem::Version
162
- version: '0'
176
+ version: 0.5.2
163
177
  type: :development
164
178
  prerelease: false
165
179
  version_requirements: !ruby/object:Gem::Requirement
166
180
  requirements:
167
181
  - - ">="
168
182
  - !ruby/object:Gem::Version
169
- version: '0'
183
+ version: 0.5.2
170
184
  description: Spinach is a BDD framework on top of gherkin
171
185
  email:
172
186
  - info@codegram.com
@@ -308,7 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
322
  version: '0'
309
323
  requirements: []
310
324
  rubyforge_project:
311
- rubygems_version: 2.2.0
325
+ rubygems_version: 2.2.2
312
326
  signing_key:
313
327
  specification_version: 4
314
328
  summary: Spinach is a BDD framework on top of gherkin