step_master 0.0.1 → 0.0.2
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/History.txt +5 -0
- data/README.rdoc +2 -2
- data/lib/step_master/matcher.rb +5 -1
- data/lib/step_master.rb +1 -1
- data/spec/step_helper/matcher_spec.rb +35 -0
- metadata +2 -2
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -27,7 +27,7 @@ none
|
|
27
27
|
|
28
28
|
== INSTALL:
|
29
29
|
|
30
|
-
sudo gem install
|
30
|
+
sudo gem install step_master -s http://www.gemcutter.org
|
31
31
|
|
32
32
|
== LICENSE:
|
33
33
|
|
@@ -50,4 +50,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
50
50
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
51
51
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
52
52
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
53
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
53
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/step_master/matcher.rb
CHANGED
@@ -65,7 +65,7 @@ module StepMaster
|
|
65
65
|
regex.scan(CHUNK_REGEX).unshift(" ").unshift(step_type).collect { |i| StepItem.new(i, regex_options) }
|
66
66
|
end
|
67
67
|
|
68
|
-
elements.inject(@match_table) { |parent, i| parent[i] ||= Possible.new }.terminal!(
|
68
|
+
elements.inject(@match_table) { |parent, i| parent[i] ||= Possible.new }.terminal!(value)
|
69
69
|
end
|
70
70
|
|
71
71
|
# Returns all possible outcomes of a string.
|
@@ -93,6 +93,10 @@ module StepMaster
|
|
93
93
|
find_possible(string).any?{ |x| x.terminal? }
|
94
94
|
end
|
95
95
|
|
96
|
+
def where_is?(string)
|
97
|
+
find_possible(string).select{ |x| x.terminal? }.collect { |x| x.result }
|
98
|
+
end
|
99
|
+
|
96
100
|
private
|
97
101
|
def find_possible(input, against = @match_table)
|
98
102
|
return against.keys.collect do |x|
|
data/lib/step_master.rb
CHANGED
@@ -268,7 +268,42 @@ module StepMaster
|
|
268
268
|
@matcher.complete("Given a Provider Location").should have(1).result
|
269
269
|
@matcher.complete("Given ProviderLocation").should have(1).result
|
270
270
|
end
|
271
|
+
end
|
272
|
+
|
273
|
+
describe "with an case insensitive switch" do
|
274
|
+
before :each do
|
275
|
+
@matcher << %q~Given /^(?:a )?provider ?location (?:named |called )?"([^\"]*)" exists$/i do |name|~
|
276
|
+
end
|
277
|
+
|
278
|
+
it "should correctly auto-complete" do
|
279
|
+
@matcher.complete("Given provider location").should have(1).result
|
280
|
+
@matcher.complete("Given a Provider Location").should have(1).result
|
281
|
+
@matcher.complete("Given ProviderLocation").should have(1).result
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
describe "with an case insensitive switch" do
|
288
|
+
before :each do
|
289
|
+
@matcher << %q~Given /^this$/i do |name| # This is a comment~
|
290
|
+
end
|
291
|
+
|
292
|
+
it "should correctly auto-complete" do
|
293
|
+
@matcher.complete("Given").should have(1).result
|
294
|
+
end
|
295
|
+
|
296
|
+
it "should correctly match" do
|
297
|
+
@matcher.is_match?("Given this").should be_true
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should return the original line with where_is?" do
|
301
|
+
@matcher.where_is?("Given this").should include(%q~Given /^this$/i do |name| # This is a comment~)
|
302
|
+
end
|
303
|
+
|
304
|
+
|
271
305
|
end
|
306
|
+
|
272
307
|
|
273
308
|
|
274
309
|
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.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Holmes
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-16 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|