public
Fork of bmabey/rspec-story-tmbundle
Description: Textmate Bundle for RSpec plain text stories (forked for alternate file organization convention)
Homepage: http://benmabey.com
Clone URL: git://github.com/lukemelia/rspec-story-tmbundle.git
Search Repo:
Ignore lines before the first steps_for line in step files to avoid issues 
with requires LM/BH
brynary (author)
Fri Jun 20 08:05:09 -0700 2008
commit  2e6b70bd8d958e59beefbba612c185d5116403d3
tree    cd28085c904596d887f5bf87e5130629851111bc
parent  77b89fc5645bd308b7feb4fc80e46b2c8116ffba
...
 
 
1
2
3
...
1
2
3
4
5
0
@@ -1,3 +1,5 @@
0
+require "foo_bar_baz"
0
+
0
 steps_for(:basic) do
0
   include_steps_for :global
0
 
...
76
77
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
80
 
 
81
82
83
...
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
 
97
98
99
100
101
0
@@ -76,8 +76,26 @@ module Spec
0
           def step_definitions
0
             if File.file?(full_file_path)
0
               @steps = []
0
+
0
+ lines = File.readlines(full_file_path)
0
+ lines_to_eval = []
0
+ found_steps_for = false
0
+
0
+ lines.each do |line|
0
+ if !found_steps_for && line =~ /steps_for/
0
+ found_steps_for = true
0
+ end
0
+
0
+ if found_steps_for
0
+ lines_to_eval << line
0
+ else
0
+ lines_to_eval << "\n"
0
+ end
0
+ end
0
+
0
               @file_contents = File.read(full_file_path)
0
- eval(@file_contents)
0
+
0
+ eval(lines_to_eval.join)
0
               @steps
0
             else
0
               []
...
87
88
89
90
91
92
93
94
 
 
 
 
 
95
96
97
...
87
88
89
 
 
 
 
 
90
91
92
93
94
95
96
97
0
@@ -87,11 +87,11 @@ module Spec
0
             it "should return a list of step definitions included in this file" do
0
               @steps_file.step_definitions.should ==
0
                 [
0
- {:step => @step, :type => 'Given', :pattern => "Basic step (given)", :line => 5, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
- {:step => @step, :type => 'Given', :pattern => "another basic step", :line => 9, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
- {:step => @step, :type => 'Given', :pattern => %r{Basic regexp \(given\)}, :line => 13, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
- {:step => @step, :type => 'When', :pattern => "Basic when", :line => 17, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
- {:step => @step, :type => 'Then', :pattern => "Basic then", :line => 21, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
+ {:step => @step, :type => 'Given', :pattern => "Basic step (given)", :line => 7, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
+ {:step => @step, :type => 'Given', :pattern => "another basic step", :line => 11, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
+ {:step => @step, :type => 'Given', :pattern => %r{Basic regexp \(given\)}, :line => 15, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
+ {:step => @step, :type => 'When', :pattern => "Basic when", :line => 19, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
+ {:step => @step, :type => 'Then', :pattern => "Basic then", :line => 23, :column => 5, :file_path => @steps_file.full_file_path, :group_tag => 'basic'},
0
                 ]
0
             end
0
           end

Comments

    No one has commented yet.