cuke_modeler 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +8 -0
  3. data/features/step_definitions/feature_steps.rb +1 -1
  4. data/features/step_definitions/test_steps.rb +6 -2
  5. data/lib/cuke_modeler/directory.rb +7 -10
  6. data/lib/cuke_modeler/version.rb +1 -1
  7. data/spec/integration/background_integration_spec.rb +53 -40
  8. data/spec/integration/directory_integration_spec.rb +39 -26
  9. data/spec/integration/doc_string_integration_spec.rb +51 -43
  10. data/spec/integration/example_integration_spec.rb +71 -60
  11. data/spec/integration/feature_file_integration_spec.rb +36 -22
  12. data/spec/integration/feature_integration_spec.rb +113 -104
  13. data/spec/integration/outline_integration_spec.rb +71 -56
  14. data/spec/integration/row_integration_spec.rb +72 -0
  15. data/spec/integration/scenario_integration_spec.rb +61 -46
  16. data/spec/integration/step_integration_spec.rb +126 -117
  17. data/spec/integration/table_integration_spec.rb +67 -52
  18. data/spec/integration/table_row_integration_spec.rb +48 -40
  19. data/spec/integration/tag_integration_spec.rb +53 -45
  20. data/spec/integration/world_integration_spec.rb +2 -1
  21. data/spec/spec_helper.rb +15 -12
  22. data/spec/unit/background_unit_spec.rb +65 -50
  23. data/spec/unit/bare_bones_unit_specs.rb +2 -3
  24. data/spec/unit/containing_element_unit_specs.rb +6 -7
  25. data/spec/unit/directory_unit_spec.rb +103 -64
  26. data/spec/unit/doc_string_unit_spec.rb +113 -95
  27. data/spec/unit/example_unit_spec.rb +235 -219
  28. data/spec/unit/feature_element_unit_spec.rb +6 -6
  29. data/spec/unit/feature_element_unit_specs.rb +28 -24
  30. data/spec/unit/feature_file_unit_spec.rb +73 -63
  31. data/spec/unit/feature_unit_spec.rb +145 -111
  32. data/spec/unit/nested_element_unit_specs.rb +14 -13
  33. data/spec/unit/nested_unit_spec.rb +24 -21
  34. data/spec/unit/outline_unit_spec.rb +92 -78
  35. data/spec/unit/parsing_unit_spec.rb +55 -51
  36. data/spec/unit/prepopulated_unit_specs.rb +2 -3
  37. data/spec/unit/raw_element_unit_specs.rb +12 -11
  38. data/spec/unit/raw_unit_spec.rb +15 -12
  39. data/spec/unit/row_unit_spec.rb +68 -52
  40. data/spec/unit/scenario_unit_spec.rb +76 -62
  41. data/spec/unit/sourceable_unit_spec.rb +8 -6
  42. data/spec/unit/sourced_element_unit_specs.rb +4 -6
  43. data/spec/unit/step_unit_spec.rb +231 -203
  44. data/spec/unit/table_row_unit_spec.rb +68 -52
  45. data/spec/unit/table_unit_spec.rb +100 -82
  46. data/spec/unit/tag_unit_spec.rb +62 -48
  47. data/spec/unit/taggable_unit_spec.rb +58 -51
  48. data/spec/unit/tagged_element_unit_specs.rb +28 -26
  49. data/spec/unit/test_element_unit_spec.rb +33 -27
  50. data/spec/unit/test_element_unit_specs.rb +15 -14
  51. data/spec/unit/world_unit_spec.rb +94 -84
  52. metadata +4 -2
@@ -4,75 +4,82 @@ SimpleCov.command_name('Taggable') unless RUBY_VERSION.to_s < '1.9.0'
4
4
 
5
5
  describe 'Taggable, Unit' do
6
6
 
7
- nodule = CukeModeler::Taggable
7
+ let(:nodule) { CukeModeler::Taggable }
8
+ let(:element) { o = Object.new.extend(nodule)
8
9
 
9
- before(:each) do
10
- @element = Object.new.extend(nodule)
10
+ def o.parent_element
11
+ @parent_element
12
+ end
11
13
 
12
- def @element.parent_element
13
- @parent_element
14
- end
14
+ def o.parent_element=(parent)
15
+ @parent_element = parent
16
+ end
17
+
18
+ o
19
+ }
20
+
21
+
22
+ describe 'unique behavior' do
15
23
 
16
- def @element.parent_element=(parent)
17
- @parent_element = parent
24
+ it 'has tags' do
25
+ element.should respond_to(:tags)
26
+ element.should respond_to(:tag_elements)
18
27
  end
19
- end
20
28
 
29
+ it 'can change its tags' do
30
+ expect(element).to respond_to(:tags=)
31
+ expect(element).to respond_to(:tag_elements=)
21
32
 
22
- it 'has tags' do
23
- @element.should respond_to(:tags)
24
- @element.should respond_to(:tag_elements)
25
- end
33
+ element.tags = :some_tags
34
+ element.tags.should == :some_tags
35
+ element.tags = :some_other_tags
36
+ element.tags.should == :some_other_tags
26
37
 
27
- it 'can get and set its tags' do
28
- @element.tags = :some_tags
29
- @element.tags.should == :some_tags
30
- @element.tags = :some_other_tags
31
- @element.tags.should == :some_other_tags
38
+ element.tag_elements = :some_tag_elements
39
+ element.tag_elements.should == :some_tag_elements
40
+ element.tag_elements = :some_other_tag_elements
41
+ element.tag_elements.should == :some_other_tag_elements
42
+ end
32
43
 
33
- @element.tag_elements = :some_tag_elements
34
- @element.tag_elements.should == :some_tag_elements
35
- @element.tag_elements = :some_other_tag_elements
36
- @element.tag_elements.should == :some_other_tag_elements
37
- end
44
+ it 'has applied tags' do
45
+ element.should respond_to(:applied_tags)
46
+ element.should respond_to(:applied_tag_elements)
47
+ end
38
48
 
39
- it 'has applied tags' do
40
- @element.should respond_to(:applied_tags)
41
- @element.should respond_to(:applied_tag_elements)
42
- end
49
+ it 'inherits its applied tags from its ancestors' do
50
+ all_parent_tag_elements = [:parent_tag_element_1, :parent_tag_element_2, :grandparent_tag_element_1]
51
+ all_parent_tags = ['@parent_tag_1', '@parent_tag_2', '@grandparent_tag_1']
52
+ parent = double(:all_tags => all_parent_tags, :all_tag_elements => all_parent_tag_elements)
43
53
 
44
- it 'inherits its applied tags from its ancestors' do
45
- all_parent_tag_elements = [:parent_tag_element_1, :parent_tag_element_2, :grandparent_tag_element_1]
46
- all_parent_tags = ['@parent_tag_1', '@parent_tag_2', '@grandparent_tag_1']
47
- parent = double(:all_tags => all_parent_tags, :all_tag_elements => all_parent_tag_elements)
54
+ element.parent_element = parent
48
55
 
49
- @element.parent_element = parent
56
+ element.applied_tags.should == all_parent_tags
57
+ element.applied_tag_elements.should == all_parent_tag_elements
58
+ end
50
59
 
51
- @element.applied_tags.should == all_parent_tags
52
- @element.applied_tag_elements.should == all_parent_tag_elements
53
- end
60
+ it 'knows all of its applicable tags' do
61
+ all_parent_tag_elements = [:parent_tag_element_1, :parent_tag_element_2, :grandparent_tag_element_1]
62
+ all_parent_tags = ['@parent_tag_1', '@parent_tag_2', '@grandparent_tag_1']
63
+ own_tags = ['@tag_1', '@tag_2']
64
+ own_tag_elements = [:tag_element_1, :tag_element_2]
54
65
 
55
- it 'knows all of its applicable tags' do
56
- all_parent_tag_elements = [:parent_tag_element_1, :parent_tag_element_2, :grandparent_tag_element_1]
57
- all_parent_tags = ['@parent_tag_1', '@parent_tag_2', '@grandparent_tag_1']
58
- own_tags = ['@tag_1', '@tag_2']
59
- own_tag_elements = [:tag_element_1, :tag_element_2]
66
+ parent = double(:all_tags => all_parent_tags, :all_tag_elements => all_parent_tag_elements)
60
67
 
61
- parent = double(:all_tags => all_parent_tags, :all_tag_elements => all_parent_tag_elements)
68
+ element.parent_element = parent
69
+ element.tags = own_tags
70
+ element.tag_elements = own_tag_elements
62
71
 
63
- @element.parent_element = parent
64
- @element.tags = own_tags
65
- @element.tag_elements = own_tag_elements
72
+ element.all_tags.should == all_parent_tags + own_tags
73
+ element.all_tag_elements.should == all_parent_tag_elements + own_tag_elements
74
+ end
66
75
 
67
- @element.all_tags.should == all_parent_tags + own_tags
68
- @element.all_tag_elements.should == all_parent_tag_elements + own_tag_elements
69
- end
76
+ it 'may have no applied tags' do
77
+ element.parent_element = :not_a_tagged_object
70
78
 
71
- it 'may have no applied tags' do
72
- @element.parent_element = :not_a_tagged_object
79
+ element.applied_tags.should == []
80
+ element.applied_tag_elements.should == []
81
+ end
73
82
 
74
- @element.applied_tags.should == []
75
- @element.applied_tag_elements.should == []
76
83
  end
77
84
 
78
85
  end
@@ -4,35 +4,37 @@ shared_examples_for 'a tagged element' do
4
4
 
5
5
  # clazz must be defined by the calling file
6
6
 
7
- before(:each) do
8
- @element = clazz.new
9
- end
7
+ let(:element) { clazz.new }
8
+
10
9
 
11
10
  it 'has tags' do
12
- @element.should respond_to(:tags)
13
- @element.should respond_to(:tag_elements)
11
+ element.should respond_to(:tags)
12
+ element.should respond_to(:tag_elements)
14
13
  end
15
14
 
16
15
  it 'can get and set its tags' do
17
- @element.tags = :some_tags
18
- @element.tags.should == :some_tags
19
- @element.tags = :some_other_tags
20
- @element.tags.should == :some_other_tags
21
-
22
- @element.tag_elements = :some_tag_elements
23
- @element.tag_elements.should == :some_tag_elements
24
- @element.tag_elements = :some_other_tag_elements
25
- @element.tag_elements.should == :some_other_tag_elements
16
+ expect(element).to respond_to(:tags=)
17
+ expect(element).to respond_to(:tag_elements=)
18
+
19
+ element.tags = :some_tags
20
+ element.tags.should == :some_tags
21
+ element.tags = :some_other_tags
22
+ element.tags.should == :some_other_tags
23
+
24
+ element.tag_elements = :some_tag_elements
25
+ element.tag_elements.should == :some_tag_elements
26
+ element.tag_elements = :some_other_tag_elements
27
+ element.tag_elements.should == :some_other_tag_elements
26
28
  end
27
29
 
28
30
  it 'starts with no tags' do
29
- @element.tags.should == []
30
- @element.tag_elements.should == []
31
+ element.tags.should == []
32
+ element.tag_elements.should == []
31
33
  end
32
34
 
33
35
  it 'has applied tags' do
34
- @element.should respond_to(:applied_tags)
35
- @element.should respond_to(:applied_tag_elements)
36
+ element.should respond_to(:applied_tags)
37
+ element.should respond_to(:applied_tag_elements)
36
38
  end
37
39
 
38
40
  it 'inherits its applied tags from its ancestors' do
@@ -40,10 +42,10 @@ shared_examples_for 'a tagged element' do
40
42
  all_parent_tags = ['@parent_tag_1', '@parent_tag_2', '@grandparent_tag_1']
41
43
  parent = double(:all_tags => all_parent_tags, :all_tag_elements => all_parent_tag_elements)
42
44
 
43
- @element.parent_element = parent
45
+ element.parent_element = parent
44
46
 
45
- @element.applied_tags.should == all_parent_tags
46
- @element.applied_tag_elements.should == all_parent_tag_elements
47
+ element.applied_tags.should == all_parent_tags
48
+ element.applied_tag_elements.should == all_parent_tag_elements
47
49
  end
48
50
 
49
51
  it 'knows all of its applicable tags' do
@@ -54,12 +56,12 @@ shared_examples_for 'a tagged element' do
54
56
 
55
57
  parent = double(:all_tags => all_parent_tags, :all_tag_elements => all_parent_tag_elements)
56
58
 
57
- @element.parent_element = parent
58
- @element.tags = own_tags
59
- @element.tag_elements = own_tag_elements
59
+ element.parent_element = parent
60
+ element.tags = own_tags
61
+ element.tag_elements = own_tag_elements
60
62
 
61
- @element.all_tags.should == all_parent_tags + own_tags
62
- @element.all_tag_elements.should == all_parent_tag_elements + own_tag_elements
63
+ element.all_tags.should == all_parent_tags + own_tags
64
+ element.all_tag_elements.should == all_parent_tag_elements + own_tag_elements
63
65
  end
64
66
 
65
67
  end
@@ -5,44 +5,50 @@ SimpleCov.command_name('TestElement') unless RUBY_VERSION.to_s < '1.9.0'
5
5
  describe 'TestElement, Unit' do
6
6
 
7
7
  let(:clazz) { CukeModeler::TestElement }
8
+ let(:element) { clazz.new }
8
9
 
9
- it_should_behave_like 'a test element'
10
- it_should_behave_like 'a feature element'
11
- it_should_behave_like 'a nested element'
12
- it_should_behave_like 'a prepopulated element'
13
- it_should_behave_like 'a bare bones element'
14
10
 
11
+ describe 'common behavior' do
12
+
13
+ it_should_behave_like 'a test element'
14
+ it_should_behave_like 'a feature element'
15
+ it_should_behave_like 'a nested element'
16
+ it_should_behave_like 'a prepopulated element'
17
+ it_should_behave_like 'a bare bones element'
15
18
 
16
- before(:each) do
17
- @element = clazz.new
18
19
  end
19
20
 
20
- it 'contains only steps - #contains' do
21
- steps = [:step_1, :step_2, :step_3]
22
- @element.steps = steps
23
21
 
24
- @element.contains.should =~ steps
25
- end
22
+ describe 'unique behavior' do
26
23
 
27
- it 'can determine its equality with another TestElement - #==' do
28
- element_1 = clazz.new
29
- element_2 = clazz.new
30
- element_3 = clazz.new
24
+ it 'contains only steps' do
25
+ steps = [:step_1, :step_2, :step_3]
26
+ element.steps = steps
31
27
 
32
- element_1.steps = :some_steps
33
- element_2.steps = :some_steps
34
- element_3.steps = :some_other_steps
28
+ element.contains.should =~ steps
29
+ end
35
30
 
36
- (element_1 == element_2).should be_true
37
- (element_1 == element_3).should be_false
38
- end
31
+ it 'can determine its equality with another TestElement' do
32
+ element_1 = clazz.new
33
+ element_2 = clazz.new
34
+ element_3 = clazz.new
39
35
 
40
- it 'can gracefully be compared to other types of objects' do
41
- # Some common types of object
42
- [1, 'foo', :bar, [], {}].each do |thing|
43
- expect { @element == thing }.to_not raise_error
44
- expect(@element == thing).to be false
36
+ element_1.steps = :some_steps
37
+ element_2.steps = :some_steps
38
+ element_3.steps = :some_other_steps
39
+
40
+ (element_1 == element_2).should be_true
41
+ (element_1 == element_3).should be_false
42
+ end
43
+
44
+ it 'can gracefully be compared to other types of objects' do
45
+ # Some common types of object
46
+ [1, 'foo', :bar, [], {}].each do |thing|
47
+ expect { element == thing }.to_not raise_error
48
+ expect(element == thing).to be false
49
+ end
45
50
  end
51
+
46
52
  end
47
53
 
48
54
  end
@@ -4,30 +4,31 @@ shared_examples_for 'a test element' do
4
4
 
5
5
  # clazz must be defined by the calling file
6
6
 
7
- before(:each) do
8
- @element = clazz.new
9
- end
7
+ let(:element) { clazz.new }
8
+
10
9
 
11
- it 'has steps - #steps' do
12
- @element.should respond_to(:steps)
10
+ it 'has steps' do
11
+ element.should respond_to(:steps)
13
12
  end
14
13
 
15
- it 'can get and set its steps - #steps, #steps=' do
16
- @element.steps = :some_steps
17
- @element.steps.should == :some_steps
18
- @element.steps = :some_other_steps
19
- @element.steps.should == :some_other_steps
14
+ it 'can change its steps' do
15
+ expect(element).to respond_to(:steps=)
16
+
17
+ element.steps = :some_steps
18
+ element.steps.should == :some_steps
19
+ element.steps = :some_other_steps
20
+ element.steps.should == :some_other_steps
20
21
  end
21
22
 
22
23
  it 'starts with no steps' do
23
- @element.steps.should == []
24
+ element.steps.should == []
24
25
  end
25
26
 
26
- it 'contains steps - #contains' do
27
+ it 'contains steps' do
27
28
  steps = [:step_1, :step_2, :step_3]
28
- @element.steps = steps
29
+ element.steps = steps
29
30
 
30
- steps.each { |step| @element.contains.should include(step) }
31
+ steps.each { |step| element.contains.should include(step) }
31
32
  end
32
33
 
33
34
  end
@@ -4,125 +4,135 @@ SimpleCov.command_name('World') unless RUBY_VERSION.to_s < '1.9.0'
4
4
 
5
5
  describe 'World, Unit' do
6
6
 
7
- before(:each) do
8
- @world = CukeModeler::World
9
- @world.loaded_step_patterns.clear
10
- @world.delimiter = nil
11
- end
7
+ let(:nodule) { CukeModeler::World }
8
+ let(:world) { nodule }
12
9
 
13
- it 'has left and right delimiters used for step argument parsing - #left_delimiter, #right_delimiter' do
14
- @world.should respond_to(:left_delimiter)
15
- @world.should respond_to(:right_delimiter)
16
- end
17
10
 
18
- it 'can get and set the delimiters used for step argument parsing' do
19
- @world.left_delimiter = '"'
20
- @world.right_delimiter = '"'
21
- @world.left_delimiter.should == '"'
22
- @world.right_delimiter.should == '"'
11
+ describe 'unique behavior' do
23
12
 
24
- @world.left_delimiter = '!'
25
- @world.right_delimiter = '!'
26
- @world.left_delimiter.should == '!'
27
- @world.right_delimiter.should == '!'
28
- end
13
+ before(:each) do
14
+ world.loaded_step_patterns.clear
15
+ world.delimiter = nil
16
+ end
29
17
 
30
- it 'can have different left and right delimiters' do
31
- @world.left_delimiter = '"'
32
- @world.right_delimiter = '*'
18
+ it 'has left and right delimiters used for step argument parsing' do
19
+ world.should respond_to(:left_delimiter)
20
+ world.should respond_to(:right_delimiter)
21
+ end
33
22
 
34
- (@world.left_delimiter != @world.right_delimiter).should be_true
35
- end
23
+ it 'can get and set the delimiters used for step argument parsing' do
24
+ expect(world).to respond_to(:left_delimiter=)
25
+ expect(world).to respond_to(:right_delimiter=)
36
26
 
37
- it 'can set both of its delimiters at once - #delimiter=' do
38
- @world.delimiter = '*'
27
+ world.left_delimiter = '"'
28
+ world.right_delimiter = '"'
29
+ world.left_delimiter.should == '"'
30
+ world.right_delimiter.should == '"'
39
31
 
40
- @world.left_delimiter.should == '*'
41
- @world.right_delimiter.should == '*'
42
- end
32
+ world.left_delimiter = '!'
33
+ world.right_delimiter = '!'
34
+ world.left_delimiter.should == '!'
35
+ world.right_delimiter.should == '!'
36
+ end
43
37
 
44
- it 'starts with no delimiters' do
45
- @world.left_delimiter.should == nil
46
- @world.right_delimiter.should == nil
47
- end
38
+ it 'can have different left and right delimiters' do
39
+ world.left_delimiter = '"'
40
+ world.right_delimiter = '*'
41
+
42
+ (world.left_delimiter != world.right_delimiter).should be_true
43
+ end
48
44
 
49
- context 'step patterns' do
45
+ it 'can set both of its delimiters at once' do
46
+ world.delimiter = '*'
50
47
 
51
- it 'can load step patterns - #load_step_pattern' do
52
- @world.should respond_to(:load_step_pattern)
48
+ world.left_delimiter.should == '*'
49
+ world.right_delimiter.should == '*'
53
50
  end
54
51
 
55
- it 'starts with no patterns loaded' do
56
- @world.loaded_step_patterns.should == []
52
+ it 'starts with no delimiters' do
53
+ world.left_delimiter.should == nil
54
+ world.right_delimiter.should == nil
57
55
  end
58
56
 
59
- it 'keeps track of loaded step patterns - #loaded_step_patterns' do
60
- patterns = [/a pattern/, /another pattern/]
57
+ describe 'step patterns' do
61
58
 
62
- patterns.each do |pattern|
63
- @world.load_step_pattern(pattern)
59
+ it 'can load step patterns' do
60
+ world.should respond_to(:load_step_pattern)
64
61
  end
65
62
 
66
- @world.loaded_step_patterns.should =~ patterns
67
- end
63
+ it 'starts with no patterns loaded' do
64
+ world.loaded_step_patterns.should == []
65
+ end
68
66
 
69
- it 'can load step definition files - #load_step_file' do
70
- file_path = "#{@default_file_directory}/step_file.rb"
71
- patterns = [/a pattern/, /another pattern/]
67
+ it 'keeps track of loaded step patterns' do
68
+ patterns = [/a pattern/, /another pattern/]
72
69
 
73
- File.open(file_path, 'w') { |file|
74
70
  patterns.each do |pattern|
75
- file.puts "Given #{pattern.inspect} do end"
71
+ world.load_step_pattern(pattern)
76
72
  end
77
- }
78
73
 
79
- @world.load_step_file(file_path)
74
+ world.loaded_step_patterns.should =~ patterns
75
+ end
80
76
 
81
- @world.loaded_step_patterns.should =~ patterns
82
- end
77
+ it 'can load step definition files' do
78
+ file_path = "#{@default_file_directory}/step_file.rb"
79
+ patterns = [/a pattern/, /another pattern/]
83
80
 
84
- it 'can handle different step keywords - #load_step_file' do
85
- file_path = "#{@default_file_directory}/step_file.rb"
86
- patterns = [/given pattern/, /when pattern/, /then pattern/, /and pattern/, /but pattern/]
81
+ File.open(file_path, 'w') { |file|
82
+ patterns.each do |pattern|
83
+ file.puts "Given #{pattern.inspect} do end"
84
+ end
85
+ }
87
86
 
88
- File.open(file_path, 'w') { |file|
89
- file.puts "Given #{patterns[0].inspect} do end"
90
- file.puts "When #{patterns[1].inspect} do end"
91
- file.puts "Then #{patterns[2].inspect} do end"
92
- file.puts "And #{patterns[3].inspect} do end"
93
- file.puts "But #{patterns[4].inspect} do end"
94
- }
87
+ world.load_step_file(file_path)
95
88
 
96
- @world.load_step_file(file_path)
89
+ world.loaded_step_patterns.should =~ patterns
90
+ end
97
91
 
98
- @world.loaded_step_patterns.should =~ patterns
99
- end
92
+ it 'can handle different step keywords' do
93
+ file_path = "#{@default_file_directory}/step_file.rb"
94
+ patterns = [/given pattern/, /when pattern/, /then pattern/, /and pattern/, /but pattern/]
100
95
 
101
- it 'can handle a variety of declaration structures - #load_step_file' do
102
- file_path = "#{@default_file_directory}/step_file.rb"
103
- patterns = [/parentheses pattern/, /no parentheses pattern/, /excess whitespace pattern/]
96
+ File.open(file_path, 'w') { |file|
97
+ file.puts "Given #{patterns[0].inspect} do end"
98
+ file.puts "When #{patterns[1].inspect} do end"
99
+ file.puts "Then #{patterns[2].inspect} do end"
100
+ file.puts "And #{patterns[3].inspect} do end"
101
+ file.puts "But #{patterns[4].inspect} do end"
102
+ }
104
103
 
105
- File.open(file_path, 'w') { |file|
106
- file.puts "Given(#{patterns[0].inspect}) do end"
107
- file.puts "Given #{patterns[1].inspect} do end"
108
- file.puts "Given #{patterns[2].inspect} do end"
109
- }
104
+ world.load_step_file(file_path)
110
105
 
111
- @world.load_step_file(file_path)
106
+ world.loaded_step_patterns.should =~ patterns
107
+ end
112
108
 
113
- @world.loaded_step_patterns.should =~ patterns
114
- end
109
+ it 'can handle a variety of declaration structures' do
110
+ file_path = "#{@default_file_directory}/step_file.rb"
111
+ patterns = [/parentheses pattern/, /no parentheses pattern/, /excess whitespace pattern/]
112
+
113
+ File.open(file_path, 'w') { |file|
114
+ file.puts "Given(#{patterns[0].inspect}) do end"
115
+ file.puts "Given #{patterns[1].inspect} do end"
116
+ file.puts "Given #{patterns[2].inspect} do end"
117
+ }
115
118
 
116
- it 'can clear its loaded step patterns - #clear_step_patterns' do
117
- patterns = [/a pattern/, /another pattern/]
119
+ world.load_step_file(file_path)
120
+
121
+ world.loaded_step_patterns.should =~ patterns
122
+ end
123
+
124
+ it 'can clear its loaded step patterns' do
125
+ patterns = [/a pattern/, /another pattern/]
126
+
127
+ patterns.each do |pattern|
128
+ world.load_step_pattern(pattern)
129
+ end
118
130
 
119
- patterns.each do |pattern|
120
- @world.load_step_pattern(pattern)
131
+ world.loaded_step_patterns.should =~ patterns
132
+ world.clear_step_patterns
133
+ world.loaded_step_patterns.should == []
121
134
  end
122
135
 
123
- @world.loaded_step_patterns.should =~ patterns
124
- @world.clear_step_patterns
125
- @world.loaded_step_patterns.should == []
126
136
  end
127
137
 
128
138
  end