public
Description: Behaviour Driven Development framework for Ruby
Homepage: http://rspec.info
Clone URL: git://github.com/dchelimsky/rspec.git
Click here to lend your support to: rspec and make a donation at www.pledgie.com !
eliminated  (use Spec::Runner.options instead)
dchelimsky (author)
Sat Jul 12 10:16:12 -0700 2008
commit  12c433f3f5c858b376f97fa472b3c90d8a25e631
tree    fdadbc1a04b0a0cd20612a17ebfb9c9031886a16
parent  dba2943e4ccbf11e6821636cf91fc4bbcb627951
...
1
2
3
4
 
...
1
2
3
 
4
0
@@ -1,4 +1,4 @@
0
 #!/usr/bin/env ruby
0
 $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
0
 require 'spec'
0
-exit ::Spec::Runner::CommandLine.run(Spec::Runner.options)
0
+exit ::Spec::Runner::CommandLine.run
...
198
199
200
201
 
202
203
204
 
205
206
207
208
209
210
 
211
212
213
...
198
199
200
 
201
202
203
 
204
205
 
206
207
208
 
209
210
211
212
0
@@ -198,16 +198,15 @@ module Spec
0
       end
0
 
0
       def options
0
- $rspec_options ||= begin; \
0
+ @rspec_options ||= begin; \
0
           parser = ::Spec::Runner::OptionParser.new(STDERR, STDOUT); \
0
           parser.order!(ARGV); \
0
- $rspec_options = parser.options; \
0
+ parser.options; \
0
         end
0
- $rspec_options
0
       end
0
 
0
       def init_options(options)
0
- $rspec_options = options if $rspec_options.nil?
0
+ @rspec_options = options
0
       end
0
 
0
     end
...
6
7
8
9
 
10
11
12
13
14
15
16
 
17
18
19
 
20
21
 
22
23
24
...
6
7
8
 
9
10
11
12
13
14
 
15
16
17
 
 
18
19
 
20
21
22
23
0
@@ -6,19 +6,18 @@ module Spec
0
     class CommandLine
0
       class << self
0
         # Runs examples.
0
- def run(instance_rspec_options)
0
+ def run(instance_rspec_options=Spec::Runner.options)
0
           # NOTE - this call to Spec::Runner.init_options is not spec'd, but
0
           # neither is any of this swapping of $rspec_options. That is all
0
           # here to enable rspec to run against itself and maintain coverage
0
           # in a single process. Therefore, DO NOT mess with this stuff unless
0
           # you know what you are doing!
0
- Spec::Runner.init_options(instance_rspec_options)
0
           orig_rspec_options = Spec::Runner.options
0
+ Spec::Runner.init_options(instance_rspec_options)
0
           begin
0
- $rspec_options = instance_rspec_options
0
- return $rspec_options.run_examples
0
+ return instance_rspec_options.run_examples
0
           ensure
0
- $rspec_options = orig_rspec_options
0
+ Spec::Runner.init_options(orig_rspec_options)
0
           end
0
         end
0
       end
...
23
24
25
26
 
27
28
 
29
30
31
...
43
44
45
46
 
47
48
49
...
23
24
25
 
26
27
 
28
29
30
31
...
43
44
45
 
46
47
48
49
0
@@ -23,9 +23,9 @@ module Spec
0
 
0
       describe "lifecycle" do
0
         before do
0
- @original_rspec_options = $rspec_options
0
+ @original_rspec_options = Spec::Runner.options
0
           @options = ::Spec::Runner::Options.new(StringIO.new, StringIO.new)
0
- $rspec_options = @options
0
+ Spec::Runner.init_options(@options)
0
           @options.formatters << mock("formatter", :null_object => true)
0
           @options.backtrace_tweaker = mock("backtrace_tweaker", :null_object => true)
0
           @reporter = FakeReporter.new(@options)
0
@@ -43,7 +43,7 @@ module Spec
0
         end
0
 
0
         after do
0
- $rspec_options = @original_rspec_options
0
+ Spec::Runner.init_options(@original_rspec_options)
0
           ExampleMethods.instance_variable_set("@before_all_parts", [])
0
           ExampleMethods.instance_variable_set("@before_each_parts", [])
0
           ExampleMethods.instance_variable_set("@after_each_parts", [])
...
232
233
234
235
 
236
237
238
239
240
241
 
242
243
244
245
246
 
247
248
249
...
232
233
234
 
235
236
237
238
239
240
 
241
242
243
244
245
 
246
247
248
249
0
@@ -232,18 +232,18 @@ describe "OptionParser" do
0
   describe "when attempting a focussed spec" do
0
     attr_reader :file, :dir
0
     before do
0
- @original_rspec_options = $rspec_options
0
+ @original_rspec_options = Spec::Runner.options
0
       @file = "#{File.dirname(__FILE__)}/spec_parser/spec_parser_fixture.rb"
0
       @dir = File.dirname(file)
0
     end
0
   
0
     after do
0
- $rspec_options = @original_rspec_options
0
+ Spec::Runner.init_options(@original_rspec_options)
0
     end
0
   
0
     def parse(args)
0
       options = super
0
- $rspec_options = options
0
+ Spec::Runner.init_options(options)
0
       options.filename_pattern = "*_fixture.rb"
0
       options
0
     end
...
3
4
5
6
7
 
 
8
9
10
11
12
13
14
 
15
16
17
...
3
4
5
 
 
6
7
8
9
10
11
12
13
 
14
15
16
17
0
@@ -3,15 +3,15 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
0
 describe "SpecParser" do
0
   attr_reader :parser, :file
0
   before(:each) do
0
- @original_rspec_options = $rspec_options
0
- $rspec_options = ::Spec::Runner::Options.new(StringIO.new, StringIO.new)
0
+ @original_rspec_options = Spec::Runner.options
0
+ Spec::Runner.init_options(::Spec::Runner::Options.new(StringIO.new, StringIO.new))
0
     @parser = Spec::Runner::SpecParser.new
0
     @file = "#{File.dirname(__FILE__)}/spec_parser/spec_parser_fixture.rb"
0
     load file
0
   end
0
 
0
   after do
0
- $rspec_options = @original_rspec_options
0
+ Spec::Runner.init_options(@original_rspec_options)
0
   end
0
 
0
   it "should find spec name for 'specify' at same line" do
...
88
89
90
91
92
93
94
95
 
96
97
 
98
99
100
101
 
 
102
103
104
...
88
89
90
 
 
 
 
91
92
93
 
94
95
96
 
 
97
98
99
100
101
0
@@ -88,16 +88,13 @@ end
0
 describe "sandboxed rspec_options", :shared => true do
0
   attr_reader :options
0
 
0
- before(:all) do
0
- @original_rspec_options = $rspec_options
0
- end
0
-
0
   before(:each) do
0
+ @original_rspec_options = Spec::Runner.options
0
     @options = ::Spec::Runner::Options.new(StringIO.new, StringIO.new)
0
- $rspec_options = options
0
+ Spec::Runner.init_options(@options)
0
   end
0
 
0
- after do
0
- $rspec_options = @original_rspec_options
0
+ after(:each) do
0
+ Spec::Runner.init_options(@original_rspec_options)
0
   end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.