rspec-core 2.0.0.a3 → 2.0.0.a4

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.
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ begin
19
19
  gem.description = 'Rspec runner and example group classes'
20
20
  gem.email = "dchelimsky@gmail.com;chad.humphries@gmail.com"
21
21
  gem.homepage = "http://github.com/rspec/core"
22
- gem.authors = ["David Chelimsky", "Chad Humphries"]
22
+ gem.authors = ["Chad Humphries", "David Chelimsky"]
23
23
  gem.rubyforge_project = "rspec"
24
24
  gem.add_development_dependency "rspec-expectations", ">= #{Rspec::Core::Version::STRING}"
25
25
  gem.add_development_dependency "rspec-mocks", ">= #{Rspec::Core::Version::STRING}"
@@ -1,8 +1 @@
1
- lib_path = File.expand_path('../../../lib', __FILE__)
2
- $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
3
- require 'rspec/autorun'
4
- require 'rspec/expectations'
5
-
6
- Rspec::Core.configure do |c|
7
- c.include Rspec::Matchers
8
- end
1
+ require File.expand_path('../../spec_helper.rb', __FILE__)
@@ -1,14 +1 @@
1
- lib_path = File.expand_path("#{File.dirname(__FILE__)}/../../lib")
2
- $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
3
- require 'rspec/autorun'
4
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '/../../../expectations/lib'))
5
- require 'rspec/expectations'
6
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '/../../../mocks/lib'))
7
- require 'rspec/mocks'
8
-
9
- Rspec::Core::ExampleGroup.send(:include, Rspec::Matchers)
10
-
11
- Rspec::Core.configure do |c|
12
- c.mock_framework = :rspec
13
- c.color_enabled = true
14
- end
1
+ require File.expand_path('../../spec_helper.rb', __FILE__)
@@ -0,0 +1,11 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ $LOAD_PATH << File.expand_path('../../../rspec-expectations/lib', __FILE__)
3
+ $LOAD_PATH << File.expand_path('../../../rspec-mocks/lib', __FILE__)
4
+ require 'rspec/expectations'
5
+ require 'rspec/autorun'
6
+
7
+ Rspec::Core.configure do |c|
8
+ c.mock_with :rspec
9
+ c.include Rspec::Matchers
10
+ end
11
+
@@ -42,8 +42,13 @@ module Rspec
42
42
  options[:profile_examples] = o
43
43
  end
44
44
 
45
+ opts.on('-b', '--backtrace', 'Enable full backtrace') do |o|
46
+ options[:full_backtrace] = true
47
+ end
48
+
45
49
  opts.on_tail('-h', '--help', "You're looking at it.") do
46
50
  puts opts
51
+ exit
47
52
  end
48
53
  end.parse!(@args)
49
54
 
@@ -1,9 +1,6 @@
1
1
  module Rspec
2
2
  module Core
3
3
  class Configuration
4
- # Regex patterns to scrub backtrace with
5
- attr_reader :backtrace_clean_patterns
6
-
7
4
  # All of the defined advice in the configuration (before/after/around)
8
5
  attr_reader :advice
9
6
 
@@ -30,7 +27,6 @@ module Rspec
30
27
  @include_or_extend_modules = []
31
28
  @filter, @exclusion_filter = nil, nil
32
29
  @options = default_options
33
- @backtrace_clean_patterns = []
34
30
  end
35
31
 
36
32
  def default_options
@@ -53,7 +49,11 @@ module Rspec
53
49
  def cleaned_from_backtrace?(line)
54
50
  options[:backtrace_clean_patterns].any? { |regex| line =~ regex }
55
51
  end
56
-
52
+
53
+ def backtrace_clean_patterns
54
+ options[:backtrace_clean_patterns]
55
+ end
56
+
57
57
  def mock_framework=(use_me_to_mock)
58
58
  options[:mock_framework] = use_me_to_mock
59
59
 
@@ -95,6 +95,10 @@ module Rspec
95
95
  options[:color_enabled] = on_or_off
96
96
  end
97
97
 
98
+ def full_backtrace=(bool)
99
+ @options[:backtrace_clean_patterns].clear
100
+ end
101
+
98
102
  def color_enabled?
99
103
  options[:color_enabled]
100
104
  end
@@ -215,6 +219,5 @@ module Rspec
215
219
  end
216
220
 
217
221
  end
218
-
219
222
  end
220
223
  end
@@ -2,12 +2,17 @@ module Rspec
2
2
  module Core
3
3
  class Example
4
4
 
5
- attr_reader :example_group, :metadata, :example_block
5
+ attr_reader :metadata, :example_block
6
+
7
+ def example_group
8
+ @example_group_class
9
+ end
10
+
6
11
  alias_method :behaviour, :example_group
7
12
 
8
- def initialize(example_group, desc, options, example_block=nil)
9
- @example_group, @options, @example_block = example_group, options, example_block
10
- @metadata = @example_group.metadata.for_example(desc, options)
13
+ def initialize(example_group_class, desc, options, example_block=nil)
14
+ @example_group_class, @options, @example_block = example_group_class, options, example_block
15
+ @metadata = @example_group_class.metadata.for_example(desc, options)
11
16
  end
12
17
 
13
18
  def description
@@ -51,11 +56,11 @@ module Rspec
51
56
 
52
57
  def run_before_each
53
58
  @example_group_instance._setup_mocks if @example_group_instance.respond_to?(:_setup_mocks)
54
- @example_group.eval_before_eachs(@example_group_instance)
59
+ @example_group_class.eval_before_eachs(@example_group_instance)
55
60
  end
56
61
 
57
62
  def run_after_each
58
- @example_group.eval_after_eachs(@example_group_instance)
63
+ @example_group_class.eval_after_eachs(@example_group_instance)
59
64
  @example_group_instance._verify_mocks if @example_group_instance.respond_to?(:_verify_mocks)
60
65
  ensure
61
66
  @example_group_instance._teardown_mocks if @example_group_instance.respond_to?(:_teardown_mocks)
@@ -93,10 +98,10 @@ module Rspec
93
98
 
94
99
  begin
95
100
  run_before_each
96
- if @example_group.around_eachs.empty?
101
+ if @example_group_class.around_eachs.empty?
97
102
  @example_group_instance.instance_eval(&example_block) if runnable?
98
103
  else
99
- @example_group.around_eachs.first.call(AroundProxy.new(self, &example_block))
104
+ @example_group_class.around_eachs.first.call(AroundProxy.new(self, &example_block))
100
105
  end
101
106
  rescue Exception => e
102
107
  exception_encountered = e
@@ -136,36 +136,36 @@ module Rspec
136
136
  @before_all_ivars ||= {}
137
137
  end
138
138
 
139
- def self.eval_before_alls(running_example_group)
140
- superclass.before_all_ivars.each { |ivar, val| running_example_group.instance_variable_set(ivar, val) }
141
- Rspec::Core.configuration.find_advice(:before, :all, self).each { |blk| running_example_group.instance_eval(&blk) }
139
+ def self.eval_before_alls(running_example)
140
+ superclass.before_all_ivars.each { |ivar, val| running_example.instance_variable_set(ivar, val) }
141
+ Rspec::Core.configuration.find_advice(:before, :all, self).each { |blk| running_example.instance_eval(&blk) }
142
142
 
143
- before_alls.each { |blk| running_example_group.instance_eval(&blk) }
144
- running_example_group.instance_variables.each { |ivar| before_all_ivars[ivar] = running_example_group.instance_variable_get(ivar) }
143
+ before_alls.each { |blk| running_example.instance_eval(&blk) }
144
+ running_example.instance_variables.each { |ivar| before_all_ivars[ivar] = running_example.instance_variable_get(ivar) }
145
145
  end
146
146
 
147
- def self.eval_before_eachs(running_example_group)
148
- Rspec::Core.configuration.find_advice(:before, :each, self).each { |blk| running_example_group.instance_eval(&blk) }
149
- before_ancestors.each { |ancestor| ancestor.before_eachs.each { |blk| running_example_group.instance_eval(&blk) } }
147
+ def self.eval_before_eachs(running_example)
148
+ Rspec::Core.configuration.find_advice(:before, :each, self).each { |blk| running_example.instance_eval(&blk) }
149
+ before_ancestors.each { |ancestor| ancestor.before_eachs.each { |blk| running_example.instance_eval(&blk) } }
150
150
  end
151
151
 
152
- def self.eval_after_alls(running_example_group)
153
- after_alls.each { |blk| running_example_group.instance_eval(&blk) }
154
- Rspec::Core.configuration.find_advice(:after, :all, self).each { |blk| running_example_group.instance_eval(&blk) }
155
- before_all_ivars.keys.each { |ivar| before_all_ivars[ivar] = running_example_group.instance_variable_get(ivar) }
152
+ def self.eval_after_alls(running_example)
153
+ after_alls.each { |blk| running_example.instance_eval(&blk) }
154
+ Rspec::Core.configuration.find_advice(:after, :all, self).each { |blk| running_example.instance_eval(&blk) }
155
+ before_all_ivars.keys.each { |ivar| before_all_ivars[ivar] = running_example.instance_variable_get(ivar) }
156
156
  end
157
157
 
158
- def self.eval_after_eachs(running_example_group)
159
- after_ancestors.each { |ancestor| ancestor.after_eachs.each { |blk| running_example_group.instance_eval(&blk) } }
160
- Rspec::Core.configuration.find_advice(:after, :each, self).each { |blk| running_example_group.instance_eval(&blk) }
158
+ def self.eval_after_eachs(running_example)
159
+ after_ancestors.each { |ancestor| ancestor.after_eachs.each { |blk| running_example.instance_eval(&blk) } }
160
+ Rspec::Core.configuration.find_advice(:after, :each, self).each { |blk| running_example.instance_eval(&blk) }
161
161
  end
162
162
 
163
163
  def self.run(reporter)
164
- example_world = new
164
+ example_group_instance = new
165
165
  reporter.add_example_group(self)
166
- eval_before_alls(example_world)
167
- success = run_examples(example_world, reporter)
168
- eval_after_alls(example_world)
166
+ eval_before_alls(example_group_instance)
167
+ success = run_examples(example_group_instance, reporter)
168
+ eval_after_alls(example_group_instance)
169
169
 
170
170
  success
171
171
  end
@@ -5,7 +5,7 @@ module Rspec # :nodoc:
5
5
  MAJOR = 2
6
6
  MINOR = 0
7
7
  TINY = 0
8
- PRE = 'a3'
8
+ PRE = 'a4'
9
9
 
10
10
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
11
11
 
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rspec-core}
8
- s.version = "2.0.0.a3"
8
+ s.version = "2.0.0.a4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["David Chelimsky", "Chad Humphries"]
12
- s.date = %q{2010-02-03}
11
+ s.authors = ["Chad Humphries", "David Chelimsky"]
12
+ s.date = %q{2010-02-04}
13
13
  s.default_executable = %q{rspec}
14
14
  s.description = %q{Rspec runner and example group classes}
15
15
  s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
@@ -74,6 +74,7 @@ Gem::Specification.new do |s|
74
74
  "example_specs/passing/stubbing_example.rb",
75
75
  "example_specs/passing/yielding_example.rb",
76
76
  "example_specs/ruby1.9.compatibility/access_to_constants_spec.rb",
77
+ "example_specs/spec_helper.rb",
77
78
  "features-pending/example_groups/example_group_with_should_methods.feature",
78
79
  "features-pending/example_groups/implicit_docstrings.feature",
79
80
  "features-pending/expectations/expect_change.feature",
@@ -174,7 +175,7 @@ Gem::Specification.new do |s|
174
175
  s.require_paths = ["lib"]
175
176
  s.rubyforge_project = %q{rspec}
176
177
  s.rubygems_version = %q{1.3.5}
177
- s.summary = %q{rspec-core 2.0.0.a3}
178
+ s.summary = %q{rspec-core 2.0.0.a4}
178
179
  s.test_files = [
179
180
  "spec/rspec/core/command_line_options_spec.rb",
180
181
  "spec/rspec/core/configuration_spec.rb",
@@ -207,17 +208,17 @@ Gem::Specification.new do |s|
207
208
  s.specification_version = 3
208
209
 
209
210
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
210
- s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.a3"])
211
- s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.a3"])
211
+ s.add_development_dependency(%q<rspec-expectations>, [">= 2.0.0.a4"])
212
+ s.add_development_dependency(%q<rspec-mocks>, [">= 2.0.0.a4"])
212
213
  s.add_development_dependency(%q<cucumber>, [">= 0.5.3"])
213
214
  else
214
- s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.a3"])
215
- s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.a3"])
215
+ s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.a4"])
216
+ s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.a4"])
216
217
  s.add_dependency(%q<cucumber>, [">= 0.5.3"])
217
218
  end
218
219
  else
219
- s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.a3"])
220
- s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.a3"])
220
+ s.add_dependency(%q<rspec-expectations>, [">= 2.0.0.a4"])
221
+ s.add_dependency(%q<rspec-mocks>, [">= 2.0.0.a4"])
221
222
  s.add_dependency(%q<cucumber>, [">= 0.5.3"])
222
223
  end
223
224
  end
@@ -73,5 +73,12 @@ describe Rspec::Core::CommandLineOptions do
73
73
 
74
74
  end
75
75
 
76
+ describe "--backtrace (-b)" do
77
+ it "sets full_backtrace on config" do
78
+ options_from_args("--backtrace").should include(:full_backtrace => true)
79
+ options_from_args("-b").should include(:full_backtrace => true)
80
+ end
81
+ end
82
+
76
83
  end
77
84
 
@@ -211,4 +211,12 @@ describe Rspec::Core::Configuration do
211
211
  end
212
212
  end
213
213
 
214
+ describe "full_backtrace=" do
215
+ it "clears the backtrace clean patterns" do
216
+ config = Rspec::Core::Configuration.new
217
+ config.full_backtrace = true
218
+ config.options[:backtrace_clean_patterns].should == []
219
+ end
220
+ end
221
+
214
222
  end
@@ -2,8 +2,8 @@ $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
2
2
  require 'rspec/core'
3
3
 
4
4
  require 'rubygems'
5
- $LOAD_PATH << File.expand_path('../../../expectations/lib', __FILE__)
6
- $LOAD_PATH << File.expand_path('../../../mocks/lib', __FILE__)
5
+ $LOAD_PATH << File.expand_path('../../../rspec-expectations/lib', __FILE__)
6
+ $LOAD_PATH << File.expand_path('../../../rspec-mocks/lib', __FILE__)
7
7
  require 'rspec/expectations'
8
8
  require 'rspec/mocks'
9
9
 
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.a3
4
+ version: 2.0.0.a4
5
5
  platform: ruby
6
6
  authors:
7
- - David Chelimsky
8
7
  - Chad Humphries
8
+ - David Chelimsky
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-02-03 00:00:00 -06:00
13
+ date: 2010-02-04 00:00:00 -06:00
14
14
  default_executable: rspec
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 2.0.0.a3
24
+ version: 2.0.0.a4
25
25
  version:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec-mocks
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 2.0.0.a3
34
+ version: 2.0.0.a4
35
35
  version:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: cucumber
@@ -108,6 +108,7 @@ files:
108
108
  - example_specs/passing/stubbing_example.rb
109
109
  - example_specs/passing/yielding_example.rb
110
110
  - example_specs/ruby1.9.compatibility/access_to_constants_spec.rb
111
+ - example_specs/spec_helper.rb
111
112
  - features-pending/example_groups/example_group_with_should_methods.feature
112
113
  - features-pending/example_groups/implicit_docstrings.feature
113
114
  - features-pending/expectations/expect_change.feature
@@ -229,7 +230,7 @@ rubyforge_project: rspec
229
230
  rubygems_version: 1.3.5
230
231
  signing_key:
231
232
  specification_version: 3
232
- summary: rspec-core 2.0.0.a3
233
+ summary: rspec-core 2.0.0.a4
233
234
  test_files:
234
235
  - spec/rspec/core/command_line_options_spec.rb
235
236
  - spec/rspec/core/configuration_spec.rb