cuke_modeler 0.3.0 → 0.4.0

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.
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,83 +4,98 @@ SimpleCov.command_name('Table') unless RUBY_VERSION.to_s < '1.9.0'
4
4
 
5
5
  describe 'Table, Integration' do
6
6
 
7
- it 'properly sets its child elements' do
8
- source = ['| cell 1 |',
9
- '| cell 2 |']
10
- source = source.join("\n")
7
+ let(:clazz) { CukeModeler::Table }
11
8
 
12
- table = CukeModeler::Table.new(source)
13
- row_1 = table.row_elements[0]
14
- row_2 = table.row_elements[1]
15
9
 
16
- row_1.parent_element.should equal table
17
- row_2.parent_element.should equal table
18
- end
19
-
20
- context 'getting stuff' do
10
+ describe 'unique behavior' do
21
11
 
22
- before(:each) do
23
- source = ['Feature: Test feature',
24
- '',
25
- ' Scenario: Test test',
26
- ' * a step:',
27
- ' | a | table |']
12
+ it 'properly sets its child elements' do
13
+ source = ['| cell 1 |',
14
+ '| cell 2 |']
28
15
  source = source.join("\n")
29
16
 
30
- file_path = "#{@default_file_directory}/table_row_test_file.feature"
31
- File.open(file_path, 'w') { |file| file.write(source) }
17
+ table = clazz.new(source)
18
+ row_1 = table.row_elements[0]
19
+ row_2 = table.row_elements[1]
32
20
 
33
- @directory = CukeModeler::Directory.new(@default_file_directory)
34
- @table = @directory.feature_files.first.features.first.tests.first.steps.first.block
21
+ row_1.parent_element.should equal table
22
+ row_2.parent_element.should equal table
35
23
  end
36
24
 
25
+ describe 'getting ancestors' do
37
26
 
38
- it 'can get its directory' do
39
- directory = @table.get_ancestor(:directory)
27
+ before(:each) do
28
+ source = ['Feature: Test feature',
29
+ '',
30
+ ' Scenario: Test test',
31
+ ' * a step:',
32
+ ' | a | table |']
33
+ source = source.join("\n")
40
34
 
41
- directory.should equal @directory
42
- end
35
+ file_path = "#{@default_file_directory}/table_row_test_file.feature"
36
+ File.open(file_path, 'w') { |file| file.write(source) }
37
+ end
43
38
 
44
- it 'can get its feature file' do
45
- feature_file = @table.get_ancestor(:feature_file)
39
+ let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
40
+ let(:table) { directory.feature_files.first.features.first.tests.first.steps.first.block }
46
41
 
47
- feature_file.should equal @directory.feature_files.first
48
- end
49
42
 
50
- it 'can get its feature' do
51
- feature = @table.get_ancestor(:feature)
43
+ it 'can get its directory' do
44
+ ancestor = table.get_ancestor(:directory)
52
45
 
53
- feature.should equal @directory.feature_files.first.features.first
54
- end
46
+ ancestor.should equal directory
47
+ end
55
48
 
56
- it 'can get its test' do
57
- test = @table.get_ancestor(:test)
49
+ it 'can get its feature file' do
50
+ ancestor = table.get_ancestor(:feature_file)
58
51
 
59
- test.should equal @directory.feature_files.first.features.first.tests.first
60
- end
52
+ ancestor.should equal directory.feature_files.first
53
+ end
61
54
 
62
- it 'can get its step' do
63
- step = @table.get_ancestor(:step)
55
+ it 'can get its feature' do
56
+ ancestor = table.get_ancestor(:feature)
64
57
 
65
- step.should equal @directory.feature_files.first.features.first.tests.first.steps.first
66
- end
58
+ ancestor.should equal directory.feature_files.first.features.first
59
+ end
60
+
61
+ it 'can get its test' do
62
+ ancestor = table.get_ancestor(:test)
63
+
64
+ ancestor.should equal directory.feature_files.first.features.first.tests.first
65
+ end
66
+
67
+ it 'can get its step' do
68
+ ancestor = table.get_ancestor(:step)
67
69
 
68
- it 'returns nil if it does not have the requested type of ancestor' do
69
- example = @table.get_ancestor(:example)
70
+ ancestor.should equal directory.feature_files.first.features.first.tests.first.steps.first
71
+ end
72
+
73
+ it 'returns nil if it does not have the requested type of ancestor' do
74
+ ancestor = table.get_ancestor(:example)
75
+
76
+ ancestor.should be_nil
77
+ end
70
78
 
71
- example.should be_nil
72
79
  end
73
80
 
74
- end
81
+ describe 'table output edge cases' do
82
+
83
+ context 'a new table object' do
84
+
85
+ let(:table) { clazz.new }
75
86
 
76
- context 'table output edge cases' do
77
- # todo - remove once #contents is no longer supported
78
- it 'can output a table that only has row elements' do
79
- table = CukeModeler::Table.new
80
- table.row_elements = [CukeModeler::TableRow.new]
81
87
 
82
- expect { table.to_s }.to_not raise_error
88
+ # todo - remove once #contents is no longer supported
89
+ it 'can output a table that only has row elements' do
90
+ table.row_elements = [CukeModeler::TableRow.new]
91
+
92
+ expect { table.to_s }.to_not raise_error
93
+ end
94
+
95
+ end
96
+
83
97
  end
84
98
 
85
99
  end
100
+
86
101
  end
@@ -4,65 +4,73 @@ SimpleCov.command_name('TableRow') unless RUBY_VERSION.to_s < '1.9.0'
4
4
 
5
5
  describe 'TableRow, Integration' do
6
6
 
7
- context 'getting stuff' do
7
+ let(:clazz) { CukeModeler::TableRow }
8
8
 
9
- before(:each) do
10
- source = ['Feature: Test feature',
11
- '',
12
- ' Scenario: Test test',
13
- ' * a step:',
14
- ' | a | table |']
15
- source = source.join("\n")
16
9
 
17
- file_path = "#{@default_file_directory}/table_row_test_file.feature"
18
- File.open(file_path, 'w') { |file| file.write(source) }
10
+ describe 'unique behavior' do
19
11
 
20
- @directory = CukeModeler::Directory.new(@default_file_directory)
21
- @table_row = @directory.feature_files.first.features.first.tests.first.steps.first.block.row_elements.first
22
- end
12
+ describe 'getting ancestors' do
23
13
 
14
+ before(:each) do
15
+ source = ['Feature: Test feature',
16
+ '',
17
+ ' Scenario: Test test',
18
+ ' * a step:',
19
+ ' | a | table |']
20
+ source = source.join("\n")
24
21
 
25
- it 'can get its directory' do
26
- directory = @table_row.get_ancestor(:directory)
22
+ file_path = "#{@default_file_directory}/table_row_test_file.feature"
23
+ File.open(file_path, 'w') { |file| file.write(source) }
24
+ end
27
25
 
28
- directory.should equal @directory
29
- end
26
+ let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
27
+ let(:table_row) { directory.feature_files.first.features.first.tests.first.steps.first.block.row_elements.first }
30
28
 
31
- it 'can get its feature file' do
32
- feature_file = @table_row.get_ancestor(:feature_file)
33
29
 
34
- feature_file.should equal @directory.feature_files.first
35
- end
30
+ it 'can get its directory' do
31
+ ancestor = table_row.get_ancestor(:directory)
36
32
 
37
- it 'can get its feature' do
38
- feature = @table_row.get_ancestor(:feature)
33
+ ancestor.should equal directory
34
+ end
39
35
 
40
- feature.should equal @directory.feature_files.first.features.first
41
- end
36
+ it 'can get its feature file' do
37
+ ancestor = table_row.get_ancestor(:feature_file)
42
38
 
43
- it 'can get its test' do
44
- test = @table_row.get_ancestor(:test)
39
+ ancestor.should equal directory.feature_files.first
40
+ end
45
41
 
46
- test.should equal @directory.feature_files.first.features.first.tests.first
47
- end
42
+ it 'can get its feature' do
43
+ ancestor = table_row.get_ancestor(:feature)
48
44
 
49
- it 'can get its step' do
50
- step = @table_row.get_ancestor(:step)
45
+ ancestor.should equal directory.feature_files.first.features.first
46
+ end
51
47
 
52
- step.should equal @directory.feature_files.first.features.first.tests.first.steps.first
53
- end
48
+ it 'can get its test' do
49
+ ancestor = table_row.get_ancestor(:test)
54
50
 
55
- it 'can get its table' do
56
- table = @table_row.get_ancestor(:table)
51
+ ancestor.should equal directory.feature_files.first.features.first.tests.first
52
+ end
57
53
 
58
- table.should equal @directory.feature_files.first.features.first.tests.first.steps.first.block
59
- end
54
+ it 'can get its step' do
55
+ ancestor = table_row.get_ancestor(:step)
56
+
57
+ ancestor.should equal directory.feature_files.first.features.first.tests.first.steps.first
58
+ end
59
+
60
+ it 'can get its table' do
61
+ ancestor = table_row.get_ancestor(:table)
60
62
 
61
- it 'returns nil if it does not have the requested type of ancestor' do
62
- example = @table_row.get_ancestor(:example)
63
+ ancestor.should equal directory.feature_files.first.features.first.tests.first.steps.first.block
64
+ end
65
+
66
+ it 'returns nil if it does not have the requested type of ancestor' do
67
+ ancestor = table_row.get_ancestor(:example)
68
+
69
+ ancestor.should be_nil
70
+ end
63
71
 
64
- example.should be_nil
65
72
  end
66
73
 
67
74
  end
75
+
68
76
  end
@@ -4,65 +4,73 @@ SimpleCov.command_name('Tag') unless RUBY_VERSION.to_s < '1.9.0'
4
4
 
5
5
  describe 'Tag, Integration' do
6
6
 
7
- context 'getting stuff' do
8
-
9
- before(:each) do
10
- source = ['@feature_tag',
11
- 'Feature: Test feature',
12
- '',
13
- ' Scenario Outline: Test test',
14
- ' * a step',
15
- '',
16
- ' @example_tag',
17
- ' Examples: Test example',
18
- ' | a param |',
19
- ' | a value |']
20
- source = source.join("\n")
21
-
22
- file_path = "#{@default_file_directory}/tag_test_file.feature"
23
- File.open(file_path, 'w') { |file| file.write(source) }
24
-
25
- @directory = CukeModeler::Directory.new(@default_file_directory)
26
- @tag = @directory.feature_files.first.features.first.tests.first.examples.first.tag_elements.first
27
- @high_level_tag = @directory.feature_files.first.features.first.tag_elements.first
28
- end
7
+ let(:clazz) { CukeModeler::Tag }
29
8
 
30
9
 
31
- it 'can get its directory' do
32
- directory = @tag.get_ancestor(:directory)
10
+ describe 'unique behavior' do
33
11
 
34
- directory.should equal @directory
35
- end
12
+ describe 'getting ancestors' do
36
13
 
37
- it 'can get its feature file' do
38
- feature_file = @tag.get_ancestor(:feature_file)
14
+ before(:each) do
15
+ source = ['@feature_tag',
16
+ 'Feature: Test feature',
17
+ '',
18
+ ' Scenario Outline: Test test',
19
+ ' * a step',
20
+ '',
21
+ ' @example_tag',
22
+ ' Examples: Test example',
23
+ ' | a param |',
24
+ ' | a value |']
25
+ source = source.join("\n")
39
26
 
40
- feature_file.should equal @directory.feature_files.first
41
- end
27
+ file_path = "#{@default_file_directory}/tag_test_file.feature"
28
+ File.open(file_path, 'w') { |file| file.write(source) }
29
+ end
42
30
 
43
- it 'can get its feature' do
44
- feature = @tag.get_ancestor(:feature)
31
+ let(:directory) { CukeModeler::Directory.new(@default_file_directory) }
32
+ let(:tag) { directory.feature_files.first.features.first.tests.first.examples.first.tag_elements.first }
33
+ let(:high_level_tag) { directory.feature_files.first.features.first.tag_elements.first }
45
34
 
46
- feature.should equal @directory.feature_files.first.features.first
47
- end
48
35
 
49
- it 'can get its test' do
50
- test = @tag.get_ancestor(:test)
36
+ it 'can get its directory' do
37
+ ancestor = tag.get_ancestor(:directory)
51
38
 
52
- test.should equal @directory.feature_files.first.features.first.tests.first
53
- end
39
+ ancestor.should equal directory
40
+ end
54
41
 
55
- it 'can get its example' do
56
- example = @tag.get_ancestor(:example)
42
+ it 'can get its feature file' do
43
+ ancestor = tag.get_ancestor(:feature_file)
57
44
 
58
- example.should equal @directory.feature_files.first.features.first.tests.first.examples.first
59
- end
45
+ ancestor.should equal directory.feature_files.first
46
+ end
47
+
48
+ it 'can get its feature' do
49
+ ancestor = tag.get_ancestor(:feature)
60
50
 
61
- it 'returns nil if it does not have the requested type of ancestor' do
62
- example = @high_level_tag.get_ancestor(:example)
51
+ ancestor.should equal directory.feature_files.first.features.first
52
+ end
53
+
54
+ it 'can get its test' do
55
+ ancestor = tag.get_ancestor(:test)
56
+
57
+ ancestor.should equal directory.feature_files.first.features.first.tests.first
58
+ end
59
+
60
+ it 'can get its example' do
61
+ ancestor = tag.get_ancestor(:example)
62
+
63
+ ancestor.should equal directory.feature_files.first.features.first.tests.first.examples.first
64
+ end
65
+
66
+ it 'returns nil if it does not have the requested type of ancestor' do
67
+ ancestor = high_level_tag.get_ancestor(:example)
68
+
69
+ ancestor.should be_nil
70
+ end
63
71
 
64
- example.should be_nil
65
72
  end
66
73
 
67
74
  end
75
+
68
76
  end
@@ -4,8 +4,9 @@ SimpleCov.command_name('World') unless RUBY_VERSION.to_s < '1.9.0'
4
4
 
5
5
  describe 'World, Integration' do
6
6
 
7
+ let(:world) { CukeModeler::World }
8
+
7
9
  before(:each) do
8
- @world = CukeModeler::World
9
10
  @world.loaded_step_patterns.clear
10
11
  end
11
12
 
@@ -1,17 +1,20 @@
1
1
  require 'simplecov' unless RUBY_VERSION.to_s < '1.9.0'
2
2
 
3
3
 
4
- require "#{File.dirname(__FILE__)}/../lib/cuke_modeler"
5
-
6
- require "#{File.dirname(__FILE__)}/unit/feature_element_unit_specs"
7
- require "#{File.dirname(__FILE__)}/unit/nested_element_unit_specs"
8
- require "#{File.dirname(__FILE__)}/unit/tagged_element_unit_specs"
9
- require "#{File.dirname(__FILE__)}/unit/containing_element_unit_specs"
10
- require "#{File.dirname(__FILE__)}/unit/bare_bones_unit_specs"
11
- require "#{File.dirname(__FILE__)}/unit/test_element_unit_specs"
12
- require "#{File.dirname(__FILE__)}/unit/prepopulated_unit_specs"
13
- require "#{File.dirname(__FILE__)}/unit/sourced_element_unit_specs"
14
- require "#{File.dirname(__FILE__)}/unit/raw_element_unit_specs"
4
+ this_dir = File.dirname(__FILE__)
5
+
6
+ require "#{this_dir}/../lib/cuke_modeler"
7
+
8
+ require "#{this_dir}/unit/feature_element_unit_specs"
9
+ require "#{this_dir}/unit/nested_element_unit_specs"
10
+ require "#{this_dir}/unit/tagged_element_unit_specs"
11
+ require "#{this_dir}/unit/containing_element_unit_specs"
12
+ require "#{this_dir}/unit/bare_bones_unit_specs"
13
+ require "#{this_dir}/unit/test_element_unit_specs"
14
+ require "#{this_dir}/unit/prepopulated_unit_specs"
15
+ require "#{this_dir}/unit/sourced_element_unit_specs"
16
+ require "#{this_dir}/unit/raw_element_unit_specs"
17
+
15
18
 
16
19
  RSpec.configure do |config|
17
20
  case
@@ -27,7 +30,7 @@ RSpec.configure do |config|
27
30
  end
28
31
 
29
32
  config.before(:all) do
30
- @default_file_directory = "#{File.dirname(__FILE__)}/temp_files"
33
+ @default_file_directory = "#{this_dir}/temp_files"
31
34
  @default_feature_file_name = 'test_feature.feature'
32
35
  end
33
36
 
@@ -5,80 +5,95 @@ SimpleCov.command_name('Background') unless RUBY_VERSION.to_s < '1.9.0'
5
5
  describe 'Background, Unit' do
6
6
 
7
7
  let(:clazz) { CukeModeler::Background }
8
+ let(:background) { clazz.new }
8
9
 
9
- it_should_behave_like 'a feature element'
10
- it_should_behave_like 'a nested element'
11
- it_should_behave_like 'a containing element'
12
- it_should_behave_like 'a bare bones element'
13
- it_should_behave_like 'a prepopulated element'
14
- it_should_behave_like 'a test element'
15
- it_should_behave_like 'a sourced element'
16
- it_should_behave_like 'a raw element'
17
10
 
18
- it 'can be parsed from stand alone text' do
19
- source = 'Background: test background'
11
+ describe 'common behavior' do
20
12
 
21
- expect { @element = clazz.new(source) }.to_not raise_error
13
+ it_should_behave_like 'a feature element'
14
+ it_should_behave_like 'a nested element'
15
+ it_should_behave_like 'a containing element'
16
+ it_should_behave_like 'a bare bones element'
17
+ it_should_behave_like 'a prepopulated element'
18
+ it_should_behave_like 'a test element'
19
+ it_should_behave_like 'a sourced element'
20
+ it_should_behave_like 'a raw element'
22
21
 
23
- # Sanity check in case instantiation failed in a non-explosive manner
24
- @element.name.should == 'test background'
25
22
  end
26
23
 
27
- it 'provides a descriptive filename when being parsed from stand alone text' do
28
- source = "bad background text \n Background:\n And a step\n @foo "
29
24
 
30
- expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_background\.feature'/)
31
- end
25
+ describe 'unique behavior' do
32
26
 
33
- it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
34
- background = clazz.new('Background: test background')
35
- raw_data = background.raw_element
27
+ it 'can be parsed from stand alone text' do
28
+ source = 'Background: test background'
36
29
 
37
- expect(raw_data.keys).to match_array([:type, :location, :keyword, :name, :steps])
38
- expect(raw_data[:type]).to eq(:Background)
39
- end
30
+ expect { @element = clazz.new(source) }.to_not raise_error
40
31
 
41
- it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
42
- background = clazz.new('Background: test background')
43
- raw_data = background.raw_element
32
+ # Sanity check in case instantiation failed in a non-explosive manner
33
+ @element.name.should == 'test background'
34
+ end
44
35
 
45
- expect(raw_data.keys).to match_array([:type, :location, :keyword, :name, :steps])
46
- expect(raw_data[:type]).to eq(:Background)
47
- end
36
+ it 'provides a descriptive filename when being parsed from stand alone text' do
37
+ source = "bad background text \n Background:\n And a step\n @foo "
48
38
 
49
- it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
50
- background = clazz.new('Background: test background')
51
- raw_data = background.raw_element
39
+ expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_background\.feature'/)
40
+ end
52
41
 
53
- expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'type'])
54
- expect(raw_data['keyword']).to eq('Background')
55
- end
42
+ it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
43
+ background = clazz.new('Background: test background')
44
+ raw_data = background.raw_element
56
45
 
46
+ expect(raw_data.keys).to match_array([:type, :location, :keyword, :name, :steps])
47
+ expect(raw_data[:type]).to eq(:Background)
48
+ end
57
49
 
58
- context 'background output edge cases' do
50
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
51
+ background = clazz.new('Background: test background')
52
+ raw_data = background.raw_element
59
53
 
60
- before(:each) do
61
- @background = clazz.new
54
+ expect(raw_data.keys).to match_array([:type, :location, :keyword, :name, :steps])
55
+ expect(raw_data[:type]).to eq(:Background)
62
56
  end
63
57
 
64
- it 'is a String' do
65
- @background.to_s.should be_a(String)
66
- end
58
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
59
+ background = clazz.new('Background: test background')
60
+ raw_data = background.raw_element
67
61
 
68
- it 'can output an empty background' do
69
- expect { @background.to_s }.to_not raise_error
62
+ expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'type'])
63
+ expect(raw_data['keyword']).to eq('Background')
70
64
  end
71
65
 
72
- it 'can output a background that has only a name' do
73
- @background.name = 'a name'
74
66
 
75
- expect { @background.to_s }.to_not raise_error
76
- end
67
+ describe 'background output edge cases' do
68
+
69
+ it 'is a String' do
70
+ background.to_s.should be_a(String)
71
+ end
72
+
73
+
74
+ context 'a new background object' do
75
+
76
+ let(:background) { clazz.new }
77
+
78
+
79
+ it 'can output an empty background' do
80
+ expect { background.to_s }.to_not raise_error
81
+ end
82
+
83
+ it 'can output a background that has only a name' do
84
+ background.name = 'a name'
85
+
86
+ expect { background.to_s }.to_not raise_error
87
+ end
88
+
89
+ it 'can output a background that has only a description' do
90
+ background.description_text = 'a description'
91
+
92
+ expect { background.to_s }.to_not raise_error
93
+ end
77
94
 
78
- it 'can output a background that has only a description' do
79
- @background.description_text = 'a description'
95
+ end
80
96
 
81
- expect { @background.to_s }.to_not raise_error
82
97
  end
83
98
 
84
99
  end