specjour 0.6.6 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,14 @@
1
1
  History
2
2
  =======
3
3
 
4
+ 0.7.0 / 2012-11-21
5
+ ---------------------------
6
+ * [added] Cucumber now distributes individual scenarios instead of files
7
+ * [fixed] Cucumber runs more than one feature (pierreozoux)
8
+ * [fixed] RSpec 2.12 compatible
9
+
10
+ [Full Changelog](https://github.com/sandro/specjour/compare/v0.6.6...v0.7.0)
11
+
4
12
  0.6.6 / 2012-11-13
5
13
  ---------------------------
6
14
  * [fixed] Not gathering all listeners (waits a full second for all replies)
@@ -29,7 +29,7 @@ module Specjour
29
29
  autoload :Cucumber, 'specjour/cucumber'
30
30
  autoload :RSpec, 'specjour/rspec'
31
31
 
32
- VERSION ||= "0.6.6"
32
+ VERSION ||= "0.7.0"
33
33
  HOOKS_PATH ||= "./.specjour/hooks.rb"
34
34
  PROGRAM_NAME ||= $PROGRAM_NAME # keep a reference of the original program name
35
35
 
@@ -25,7 +25,7 @@ module Specjour::Cucumber
25
25
  failure.scenario_outline
26
26
  end
27
27
  end.each do |failure|
28
- @failing_scenarios << format_string("cucumber " + failure.file_colon_line[2..-1], :failed) +
28
+ @failing_scenarios << format_string("cucumber " + failure.file_colon_line, :failed) +
29
29
  format_string(" # Scenario: " + failure.name, :comment)
30
30
  end
31
31
  end
@@ -1,13 +1,19 @@
1
1
  module Specjour
2
2
  module Cucumber
3
3
  module Preloader
4
- def self.load
4
+ def self.load(paths, output)
5
5
  Specjour.benchmark("Loading Cucumber Environment") do
6
6
  require 'cucumber' unless defined?(::Cucumber::Cli)
7
- configuration = ::Cucumber::Cli::Configuration.new
8
- configuration.parse! []
7
+ args = paths.unshift '--format', 'Specjour::Cucumber::DistributedFormatter'
8
+ cli = ::Cucumber::Cli::Main.new(args, output)
9
+
10
+ configuration = cli.configuration
11
+ options = configuration.instance_variable_get(:@options)
12
+ options.instance_variable_set(:@skip_profile_information, true)
13
+
9
14
  runtime = ::Cucumber::Runtime.new(configuration)
10
15
  runtime.send :load_step_definitions
16
+ runtime.send :fire_after_configuration_hook
11
17
  Cucumber.runtime = runtime
12
18
  end
13
19
  end
@@ -1,14 +1,13 @@
1
1
  module Specjour
2
2
  module Cucumber
3
3
  module Runner
4
- def self.run(feature, output)
5
- cli = ::Cucumber::Cli::Main.new(['--format', 'Specjour::Cucumber::DistributedFormatter', feature], output)
6
-
7
- Cucumber.runtime.instance_variable_set(:@configuration, cli.configuration)
4
+ def self.run(feature)
8
5
  Cucumber.runtime.instance_eval do
6
+ @loader = nil
7
+ @configuration.parse!([feature])
9
8
  tree_walker = @configuration.build_tree_walker(self)
10
9
  self.visitor = tree_walker
11
- tree_walker.visit_features(features)
10
+ tree_walker.visit_features features
12
11
  end
13
12
  end
14
13
  end
@@ -38,9 +38,9 @@ module Specjour
38
38
  def spec_files
39
39
  @spec_files ||= file_collector(spec_paths) do |path|
40
40
  if path == project_path
41
- Dir["#{path}/spec/**/*_spec.rb"]
41
+ Dir["spec/**/*_spec.rb"]
42
42
  else
43
- Dir["#{path}/**/*_spec.rb"]
43
+ Dir["**/*_spec.rb"]
44
44
  end
45
45
  end
46
46
  end
@@ -48,9 +48,9 @@ module Specjour
48
48
  def feature_files
49
49
  @feature_files ||= file_collector(feature_paths) do |path|
50
50
  if path == project_path
51
- Dir["#{path}/features/**/*.feature"]
51
+ Dir["features/**/*.feature"]
52
52
  else
53
- Dir["#{path}/**/*.feature"]
53
+ Dir["**/*.feature"]
54
54
  end
55
55
  end
56
56
  end
@@ -82,12 +82,12 @@ module Specjour
82
82
 
83
83
  def load_app
84
84
  RSpec::Preloader.load spec_files if spec_files.any?
85
- Cucumber::Preloader.load if feature_files.any?
85
+ Cucumber::Preloader.load(feature_files, connection) if feature_files.any?
86
86
  register_tests_with_printer
87
87
  end
88
88
 
89
89
  def register_tests_with_printer
90
- tests = rspec_examples | feature_files
90
+ tests = rspec_examples | cucumber_scenarios
91
91
  connection.send_message :tests=, tests
92
92
  end
93
93
 
@@ -105,7 +105,8 @@ module Specjour
105
105
  end.flatten
106
106
  locations = examples.map do |e|
107
107
  meta = e.metadata
108
- shared_group = e.example_group.ancestors.detect do |group|
108
+ groups = e.example_group.parent_groups + [e.example_group]
109
+ shared_group = groups.detect do |group|
109
110
  group.metadata[:shared_group_name]
110
111
  end
111
112
  if shared_group
@@ -117,6 +118,22 @@ module Specjour
117
118
  ::RSpec.reset
118
119
  end
119
120
 
121
+ def cucumber_scenarios
122
+ if feature_files.any?
123
+ scenarios
124
+ else
125
+ []
126
+ end
127
+ end
128
+
129
+ def scenarios
130
+ Cucumber.runtime.send(:features).map do |feature|
131
+ feature.feature_elements.map do |scenario|
132
+ "#{feature.file}:#{scenario.instance_variable_get(:@line)}"
133
+ end
134
+ end.flatten
135
+ end
136
+
120
137
  def kill_worker_processes
121
138
  signal = Specjour.interrupted? ? 'INT' : 'TERM'
122
139
  Process.kill(signal, *worker_pids) rescue Errno::ESRCH
@@ -95,7 +95,7 @@ module Specjour
95
95
  end
96
96
 
97
97
  def project_path
98
- File.join("/tmp", project_name)
98
+ File.expand_path(project_name, File.realpath('/tmp'))
99
99
  end
100
100
 
101
101
  def start
@@ -41,6 +41,8 @@ module Specjour::RSpec
41
41
  if exception = execution_result[:exception]
42
42
  execution_result[:exception] = MarshalableException.new(exception)
43
43
  end
44
+ execution_result[:started_at] = Time.at(execution_result[:started_at])
45
+ execution_result[:finished_at] = Time.at(execution_result[:finished_at])
44
46
  execution_result
45
47
  end
46
48
 
@@ -31,7 +31,7 @@ module Specjour::RSpec
31
31
  metadata_collection.map do |partial_metadata|
32
32
  example = ::RSpec::Core::Example.allocate
33
33
  example.instance_variable_set(:@example_group_class,
34
- OpenStruct.new(:metadata => {}, :ancestors => [])
34
+ OpenStruct.new(:metadata => {}, :ancestors => [], :parent_groups => [])
35
35
  )
36
36
  metadata = ::RSpec::Core::Metadata.new
37
37
  metadata.merge! partial_metadata
@@ -1,7 +1,7 @@
1
1
  class Specjour::RSpec::Preloader
2
2
  def self.load(paths=[])
3
3
  Specjour.benchmark("Loading RSpec environment") do
4
- require './spec/spec_helper'
4
+ require File.expand_path('spec/spec_helper', Dir.pwd)
5
5
  load_spec_files paths
6
6
  end
7
7
  end
@@ -74,7 +74,7 @@ module Specjour
74
74
  end
75
75
 
76
76
  def run_feature(feature)
77
- Cucumber::Runner.run(feature, connection)
77
+ Cucumber::Runner.run(feature)
78
78
  end
79
79
 
80
80
  def run_spec(spec)
@@ -88,7 +88,7 @@ module Specjour
88
88
  end
89
89
 
90
90
  def test_type(test)
91
- test =~ /\.feature$/ ? :cucumber : :rspec
91
+ test =~ /\.feature(:\d+)?$/ ? :cucumber : :rspec
92
92
  end
93
93
 
94
94
  def set_env_variables
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specjour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-14 00:00:00.000000000 Z
12
+ date: 2012-11-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dnssd
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: '2.11'
53
+ version: '2.12'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '2.11'
61
+ version: '2.12'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rr
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -177,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  segments:
179
179
  - 0
180
- hash: -327981842823844715
180
+ hash: -1349309289117832663
181
181
  required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements: