step_master 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.0.3 2009-10-16
2
+
3
+ * Loading from raw parse_table rather than having to parse the steps
4
+
1
5
  === 0.0.2 2009-10-15
2
6
 
3
7
  * Added where_is?(step) for finding which file a step is in
@@ -28,8 +28,8 @@ module StepMaster
28
28
 
29
29
  attr_reader :match_table
30
30
 
31
- def initialize
32
- @match_table = Possible.new
31
+ def initialize(match_table = Possible.new )
32
+ @match_table = match_table
33
33
  end
34
34
 
35
35
  # Insert a Ruby Step definition into the Match Table
@@ -2,7 +2,7 @@ module StepMaster
2
2
  class StepItem
3
3
  attr_reader :text, :options
4
4
 
5
- def initialize(text, opts)
5
+ def initialize(text, opts = "")
6
6
  @text = text.freeze
7
7
  @options = 0
8
8
  @options |= (opts.match(/i/) ? Regexp::IGNORECASE : 0)
data/lib/step_master.rb CHANGED
@@ -4,5 +4,5 @@ $:.unshift(File.dirname(__FILE__)) unless
4
4
  require 'step_master/matcher'
5
5
 
6
6
  module StepMaster
7
- VERSION = '0.0.2'
7
+ VERSION = '0.0.3'
8
8
  end
@@ -74,7 +74,17 @@ module StepMaster
74
74
  it "should match \"Given I want \"123\"\"" do
75
75
  @matcher.is_match?("Given I want \"!@@\"").should be_true
76
76
  end
77
- end
77
+ end
78
+
79
+ describe "with step with a comment" do
80
+ before :each do
81
+ @matcher << %q~Given /^this$/i do |name| # This is a comment~
82
+ end
83
+
84
+ it "should correctly match" do
85
+ @matcher.is_match?("Given this").should be_true
86
+ end
87
+ end
78
88
  end
79
89
 
80
90
 
@@ -284,7 +294,7 @@ module StepMaster
284
294
 
285
295
 
286
296
 
287
- describe "with an case insensitive switch" do
297
+ describe "with step with a comment" do
288
298
  before :each do
289
299
  @matcher << %q~Given /^this$/i do |name| # This is a comment~
290
300
  end
@@ -292,20 +302,39 @@ module StepMaster
292
302
  it "should correctly auto-complete" do
293
303
  @matcher.complete("Given").should have(1).result
294
304
  end
295
-
296
- it "should correctly match" do
297
- @matcher.is_match?("Given this").should be_true
305
+ end
306
+
307
+ end
308
+ describe "#where_is?" do
309
+ describe "with step with a comment" do
310
+ before :each do
311
+ @matcher << %q~Given /^this$/i do |name| # This is a comment~
298
312
  end
299
313
 
300
314
  it "should return the original line with where_is?" do
301
315
  @matcher.where_is?("Given this").should include(%q~Given /^this$/i do |name| # This is a comment~)
302
316
  end
303
-
304
-
305
- end
306
-
317
+ end
318
+ end
319
+ end
320
+
321
+ describe Matcher do
322
+ describe "swith a pre-parsed match table" do
307
323
 
324
+ before :each do
325
+ p = Possible.new
326
+ p[si = StepItem.new("Given")] = Possible.new
327
+ p[si][si2 = StepItem.new(" ")] = Possible.new()
328
+ (p[si][si2][StepItem.new("this")] = Possible.new()).terminal!("Given this")
329
+
330
+ @matcher = Matcher.new(p)
331
+ end
308
332
 
309
- end
333
+ it "should be able to perform a simple match" do
334
+ @matcher.is_match?("Given this").should be_true
335
+ end
336
+ end
337
+
310
338
  end
339
+
311
340
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: step_master
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Holmes