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.
- checksums.yaml +4 -4
- data/History.rdoc +8 -0
- data/features/step_definitions/feature_steps.rb +1 -1
- data/features/step_definitions/test_steps.rb +6 -2
- data/lib/cuke_modeler/directory.rb +7 -10
- data/lib/cuke_modeler/version.rb +1 -1
- data/spec/integration/background_integration_spec.rb +53 -40
- data/spec/integration/directory_integration_spec.rb +39 -26
- data/spec/integration/doc_string_integration_spec.rb +51 -43
- data/spec/integration/example_integration_spec.rb +71 -60
- data/spec/integration/feature_file_integration_spec.rb +36 -22
- data/spec/integration/feature_integration_spec.rb +113 -104
- data/spec/integration/outline_integration_spec.rb +71 -56
- data/spec/integration/row_integration_spec.rb +72 -0
- data/spec/integration/scenario_integration_spec.rb +61 -46
- data/spec/integration/step_integration_spec.rb +126 -117
- data/spec/integration/table_integration_spec.rb +67 -52
- data/spec/integration/table_row_integration_spec.rb +48 -40
- data/spec/integration/tag_integration_spec.rb +53 -45
- data/spec/integration/world_integration_spec.rb +2 -1
- data/spec/spec_helper.rb +15 -12
- data/spec/unit/background_unit_spec.rb +65 -50
- data/spec/unit/bare_bones_unit_specs.rb +2 -3
- data/spec/unit/containing_element_unit_specs.rb +6 -7
- data/spec/unit/directory_unit_spec.rb +103 -64
- data/spec/unit/doc_string_unit_spec.rb +113 -95
- data/spec/unit/example_unit_spec.rb +235 -219
- data/spec/unit/feature_element_unit_spec.rb +6 -6
- data/spec/unit/feature_element_unit_specs.rb +28 -24
- data/spec/unit/feature_file_unit_spec.rb +73 -63
- data/spec/unit/feature_unit_spec.rb +145 -111
- data/spec/unit/nested_element_unit_specs.rb +14 -13
- data/spec/unit/nested_unit_spec.rb +24 -21
- data/spec/unit/outline_unit_spec.rb +92 -78
- data/spec/unit/parsing_unit_spec.rb +55 -51
- data/spec/unit/prepopulated_unit_specs.rb +2 -3
- data/spec/unit/raw_element_unit_specs.rb +12 -11
- data/spec/unit/raw_unit_spec.rb +15 -12
- data/spec/unit/row_unit_spec.rb +68 -52
- data/spec/unit/scenario_unit_spec.rb +76 -62
- data/spec/unit/sourceable_unit_spec.rb +8 -6
- data/spec/unit/sourced_element_unit_specs.rb +4 -6
- data/spec/unit/step_unit_spec.rb +231 -203
- data/spec/unit/table_row_unit_spec.rb +68 -52
- data/spec/unit/table_unit_spec.rb +100 -82
- data/spec/unit/tag_unit_spec.rb +62 -48
- data/spec/unit/taggable_unit_spec.rb +58 -51
- data/spec/unit/tagged_element_unit_specs.rb +28 -26
- data/spec/unit/test_element_unit_spec.rb +33 -27
- data/spec/unit/test_element_unit_specs.rb +15 -14
- data/spec/unit/world_unit_spec.rb +94 -84
- 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
|
-
|
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
|
-
|
17
|
-
row_2.parent_element.should equal table
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'getting stuff' do
|
10
|
+
describe 'unique behavior' do
|
21
11
|
|
22
|
-
|
23
|
-
source = ['
|
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
|
-
|
31
|
-
|
17
|
+
table = clazz.new(source)
|
18
|
+
row_1 = table.row_elements[0]
|
19
|
+
row_2 = table.row_elements[1]
|
32
20
|
|
33
|
-
|
34
|
-
|
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
|
-
|
39
|
-
|
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
|
-
|
42
|
-
|
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
|
-
|
45
|
-
|
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
|
-
|
51
|
-
|
43
|
+
it 'can get its directory' do
|
44
|
+
ancestor = table.get_ancestor(:directory)
|
52
45
|
|
53
|
-
|
54
|
-
|
46
|
+
ancestor.should equal directory
|
47
|
+
end
|
55
48
|
|
56
|
-
|
57
|
-
|
49
|
+
it 'can get its feature file' do
|
50
|
+
ancestor = table.get_ancestor(:feature_file)
|
58
51
|
|
59
|
-
|
60
|
-
|
52
|
+
ancestor.should equal directory.feature_files.first
|
53
|
+
end
|
61
54
|
|
62
|
-
|
63
|
-
|
55
|
+
it 'can get its feature' do
|
56
|
+
ancestor = table.get_ancestor(:feature)
|
64
57
|
|
65
|
-
|
66
|
-
|
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
|
-
|
69
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
18
|
-
File.open(file_path, 'w') { |file| file.write(source) }
|
10
|
+
describe 'unique behavior' do
|
19
11
|
|
20
|
-
|
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
|
-
|
26
|
-
|
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
|
29
|
-
|
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
|
-
|
35
|
-
|
30
|
+
it 'can get its directory' do
|
31
|
+
ancestor = table_row.get_ancestor(:directory)
|
36
32
|
|
37
|
-
|
38
|
-
|
33
|
+
ancestor.should equal directory
|
34
|
+
end
|
39
35
|
|
40
|
-
feature
|
41
|
-
|
36
|
+
it 'can get its feature file' do
|
37
|
+
ancestor = table_row.get_ancestor(:feature_file)
|
42
38
|
|
43
|
-
|
44
|
-
|
39
|
+
ancestor.should equal directory.feature_files.first
|
40
|
+
end
|
45
41
|
|
46
|
-
|
47
|
-
|
42
|
+
it 'can get its feature' do
|
43
|
+
ancestor = table_row.get_ancestor(:feature)
|
48
44
|
|
49
|
-
|
50
|
-
|
45
|
+
ancestor.should equal directory.feature_files.first.features.first
|
46
|
+
end
|
51
47
|
|
52
|
-
|
53
|
-
|
48
|
+
it 'can get its test' do
|
49
|
+
ancestor = table_row.get_ancestor(:test)
|
54
50
|
|
55
|
-
|
56
|
-
|
51
|
+
ancestor.should equal directory.feature_files.first.features.first.tests.first
|
52
|
+
end
|
57
53
|
|
58
|
-
|
59
|
-
|
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
|
-
|
62
|
-
|
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
|
-
|
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
|
-
|
32
|
-
directory = @tag.get_ancestor(:directory)
|
10
|
+
describe 'unique behavior' do
|
33
11
|
|
34
|
-
|
35
|
-
end
|
12
|
+
describe 'getting ancestors' do
|
36
13
|
|
37
|
-
|
38
|
-
|
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
|
-
|
41
|
-
|
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
|
-
|
44
|
-
|
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
|
-
|
50
|
-
|
36
|
+
it 'can get its directory' do
|
37
|
+
ancestor = tag.get_ancestor(:directory)
|
51
38
|
|
52
|
-
|
53
|
-
|
39
|
+
ancestor.should equal directory
|
40
|
+
end
|
54
41
|
|
55
|
-
|
56
|
-
|
42
|
+
it 'can get its feature file' do
|
43
|
+
ancestor = tag.get_ancestor(:feature_file)
|
57
44
|
|
58
|
-
|
59
|
-
|
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
|
-
|
62
|
-
|
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
|
data/spec/spec_helper.rb
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
require 'simplecov' unless RUBY_VERSION.to_s < '1.9.0'
|
2
2
|
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
require "#{
|
7
|
-
|
8
|
-
require "#{
|
9
|
-
require "#{
|
10
|
-
require "#{
|
11
|
-
require "#{
|
12
|
-
require "#{
|
13
|
-
require "#{
|
14
|
-
require "#{
|
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 = "#{
|
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
|
-
|
19
|
-
source = 'Background: test background'
|
11
|
+
describe 'common behavior' do
|
20
12
|
|
21
|
-
|
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
|
-
|
31
|
-
end
|
25
|
+
describe 'unique behavior' do
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
raw_data = background.raw_element
|
27
|
+
it 'can be parsed from stand alone text' do
|
28
|
+
source = 'Background: test background'
|
36
29
|
|
37
|
-
|
38
|
-
expect(raw_data[:type]).to eq(:Background)
|
39
|
-
end
|
30
|
+
expect { @element = clazz.new(source) }.to_not raise_error
|
40
31
|
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
# Sanity check in case instantiation failed in a non-explosive manner
|
33
|
+
@element.name.should == 'test background'
|
34
|
+
end
|
44
35
|
|
45
|
-
|
46
|
-
|
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
|
-
|
50
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
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
|
-
|
61
|
-
|
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 '
|
65
|
-
|
66
|
-
|
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
|
-
|
69
|
-
expect
|
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
|
-
|
76
|
-
|
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
|
-
|
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
|