cucumber_analytics 1.3.0 → 1.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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzFmZGE0MWM0NzI0MmQ2NWMxYWM3MmI1YWRlMjIwYThjNTAwMWIzZg==
4
+ NjM2NzlkYjkxNTg1ZmU0NDE4MjVkZjk2MGJjNzljMGE0NDVkMTMxMA==
5
5
  data.tar.gz: !binary |-
6
- NDkzOWY5ODZkNjY5MWVhN2Q1ZGViM2VlMTkxN2EyNDY5M2Y0ODA2OQ==
6
+ MGNjNDMxOGRiNjVhZWQ2OWE2MjFmYjlmNGE3MmIwNDYwY2M1ZmMwNw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZGM5Mjc0ZTEwODZlMmViM2I2M2NiYmEzZDM3NzhhNmVkZmI4ZTMwY2IwZjhm
10
- N2U1ZDAyYjg0OWJiN2U3ZDM2OTE4MjliM2U1MzdjZmFmM2UyMDFjNjlhNmI2
11
- NDQxY2ZmZDUxZjIyMzYzOGU5M2FlYTUxZDFjZWNjYWQ1ZmRlMzE=
9
+ ZTEzOTE2NGVjNzEzZDJhZTFhYjgzNTgzNWU5MmE0YmY5ZWU4MzlmOThiN2E3
10
+ YTBjZjIwNjNjYzk5YTkzYmE1MjgxMjU5NzQ4YWI0MDcyNTFmZWEzMTA5ZTc2
11
+ NDY4MzMxY2YyOTRhY2VjZTlmOTBiYjk4MTc5YjlmYmQyZWY3YTM=
12
12
  data.tar.gz: !binary |-
13
- ODBjNDRmN2JjOWY3ZGJlYmE0YWI5ZWJhMDkzNzAyMGRlM2IxOTJkMmMyNTk2
14
- YjM1NzRiYjkyNzgzZDFiZWRhMGYxZTgzNGY0M2VjYzBiM2Y2MzQ5ZGE5Y2Vk
15
- MjU3YTM0NmQ1NmMxYzQ5YzYzZjQ1ZjdjNzY3NjE2NGZiYjlhYTM=
13
+ NDU3ZjE5MDI0MGUyZjFjOWY1ZmExNTQxNDU3MWYzYjI4YzI5MTlmMjZkMDU5
14
+ MzQyNmNiMGY3NDdhNmY4ZDEzNjRiM2I5ODQ3ZmNkMTM0NzdlYWRmODM2YWI4
15
+ MGQzMmNiZWZhOTY0NDI5ZTg1MjYxZDU5NGVjY2RmY2U0MDEzNjE=
@@ -1,3 +1,9 @@
1
+ === Version 1.4.0 / 2013-11-05
2
+
3
+ * Step table rows are now modeled. Non-object table rows have been retained in
4
+ order to remain backwards compatible.
5
+
6
+
1
7
  === Version 1.3.0 / 2013-10-02
2
8
 
3
9
  * Elements now have a convenience method for accessing their ancestor elements.
@@ -43,3 +43,4 @@ Feature: Table elements can be modeled.
43
43
  Examples:
44
44
  | additional specifications |
45
45
  | table_unit_spec.rb |
46
+ | table_integration_spec.rb |
@@ -0,0 +1,61 @@
1
+ Feature: Table Row elements can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ All conceptual pieces of a table row can be modeled:
7
+ 1. the row's source line
8
+ 2. the row's cells
9
+ 3. the row's raw element
10
+
11
+
12
+ Background: Test file setup.
13
+ Given the following feature file:
14
+ """
15
+ Feature:
16
+
17
+ Scenario:
18
+ * some data filled step:
19
+ | value 1 | value 2 |
20
+ | value 3 | value 4 |
21
+ * some data filled step:
22
+ | value 1 |
23
+ | value 2 |
24
+ """
25
+ When the file is read
26
+
27
+
28
+ Scenario: The raw table row element is modeled.
29
+ Then the step table row correctly stores its underlying implementation
30
+
31
+ Scenario: The table row's source line is modeled.
32
+ Then step "1" table row "1" is found to have the following properties:
33
+ | source_line | 5 |
34
+ And step "1" table row "2" is found to have the following properties:
35
+ | source_line | 6 |
36
+ And step "2" table row "1" is found to have the following properties:
37
+ | source_line | 8 |
38
+ And step "2" table row "2" is found to have the following properties:
39
+ | source_line | 9 |
40
+
41
+ Scenario: The table row's cells are modeled.
42
+ Then step "1" table row "1" cells are as follows:
43
+ | value 1 |
44
+ | value 2 |
45
+ And step "1" table row "2" cells are as follows:
46
+ | value 3 |
47
+ | value 4 |
48
+ And step "2" table row "1" cells are as follows:
49
+ | value 1 |
50
+ And step "2" table row "2" cells are as follows:
51
+ | value 2 |
52
+
53
+ Scenario Outline: Table row models pass all other specifications
54
+ Exact specifications detailing the API for table table row models.
55
+ Given that there are "<additional specifications>" detailing models
56
+ When the corresponding specifications are run
57
+ Then all of those specifications are met
58
+ Examples:
59
+ | additional specifications |
60
+ | table_row_unit_spec.rb |
61
+ | table_row_integration_spec.rb |
@@ -110,3 +110,42 @@ Then /^(?:the )?(?:feature "([^"]*)" )?test(?: "([^"]*)")? step(?: "([^"]*)")? c
110
110
 
111
111
  raw_element.has_key?('keyword').should be_true
112
112
  end
113
+
114
+ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?step(?: "([^"]*)")? table row(?: "([^"]*)")? is found to have the following properties:$/ do |file, test, step, row, properties|
115
+ file ||= 1
116
+ test ||= 1
117
+ step ||= 1
118
+ row ||= 1
119
+
120
+ properties = properties.rows_hash
121
+
122
+ properties.each do |property, value|
123
+ expected = value
124
+ actual = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.row_elements[row - 1].send(property.to_sym).to_s
125
+
126
+ assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
127
+ end
128
+ end
129
+
130
+ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?step(?: "([^"]*)")? table row(?: "([^"]*)")? correctly stores its underlying implementation$/ do |file, test, step, row|
131
+ file ||= 1
132
+ test ||= 1
133
+ step ||= 1
134
+ row ||= 1
135
+
136
+ raw_element = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.row_elements[row - 1].raw_element
137
+
138
+ raw_element.has_key?('cells').should be_true
139
+ end
140
+
141
+ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?step(?: "([^"]*)")? table row(?: "([^"]*)")? cells are as follows:$/ do |file, test, step, row, cells|
142
+ file ||= 1
143
+ test ||= 1
144
+ step ||= 1
145
+ row ||= 1
146
+
147
+ expected = cells.raw.flatten
148
+ actual = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.row_elements[row - 1].cells
149
+
150
+ assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
151
+ end
@@ -4,7 +4,7 @@ Then /^(?:the )?(?:feature "([^"]*)" )?(?:test(?: "([^"]*)")? )?(?:step(?: "([^"
4
4
  step ||= 1
5
5
 
6
6
  expected = contents.raw
7
- actual = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.contents
7
+ actual = @parsed_files[file - 1].feature.tests[test - 1].steps[step - 1].block.row_elements.collect{|row| row.cells}
8
8
 
9
9
  assert(actual == expected, "Expected: #{expected}\n but was: #{actual}")
10
10
  end
@@ -19,4 +19,5 @@ require 'cucumber_analytics/doc_string'
19
19
  require 'cucumber_analytics/table'
20
20
  require 'cucumber_analytics/world'
21
21
  require 'cucumber_analytics/row'
22
+ require 'cucumber_analytics/table_row'
22
23
  require 'cucumber_analytics/tag'
@@ -17,6 +17,7 @@ module CucumberAnalytics
17
17
  :feature => Feature,
18
18
  :test => TestElement,
19
19
  :step => Step,
20
+ :table => Table,
20
21
  :example => Example
21
22
  }[ancestor_type]
22
23
 
@@ -4,6 +4,7 @@ module CucumberAnalytics
4
4
 
5
5
  class Table
6
6
 
7
+ include Containing
7
8
  include Raw
8
9
  include Nested
9
10
 
@@ -11,11 +12,15 @@ module CucumberAnalytics
11
12
  # The contents of the table
12
13
  attr_accessor :contents
13
14
 
15
+ # The row elements that make up the table
16
+ attr_accessor :row_elements
17
+
14
18
 
15
19
  # Creates a new Table object and, if *source* is provided, populates
16
20
  # the object.
17
21
  def initialize(source = nil)
18
22
  @contents = []
23
+ @row_elements = []
19
24
 
20
25
  parsed_table = process_source(source)
21
26
 
@@ -46,6 +51,7 @@ module CucumberAnalytics
46
51
 
47
52
  def build_table(table)
48
53
  populate_contents(table)
54
+ populate_row_elements(table)
49
55
  populate_raw_element(table)
50
56
  end
51
57
 
@@ -53,5 +59,11 @@ module CucumberAnalytics
53
59
  @contents = table.collect { |row| row['cells'] }
54
60
  end
55
61
 
62
+ def populate_row_elements(table)
63
+ table.each do |row|
64
+ @row_elements << build_child_element(TableRow, row)
65
+ end
66
+ end
67
+
56
68
  end
57
69
  end
@@ -0,0 +1,59 @@
1
+ module CucumberAnalytics
2
+
3
+ # A class modeling a step table row.
4
+
5
+ class TableRow
6
+
7
+ include Sourceable
8
+ include Raw
9
+ include Nested
10
+
11
+
12
+ # The cells that make up the row
13
+ attr_accessor :cells
14
+
15
+
16
+ # Creates a new TableRow object and, if *source* is provided, populates
17
+ # the object.
18
+ def initialize(source = nil)
19
+ parsed_row = process_source(source)
20
+
21
+ @cells = []
22
+
23
+ build_row(parsed_row) if parsed_row
24
+ end
25
+
26
+
27
+ private
28
+
29
+
30
+ def process_source(source)
31
+ case
32
+ when source.is_a?(String)
33
+ parse_row(source)
34
+ else
35
+ source
36
+ end
37
+ end
38
+
39
+ def parse_row(source_text)
40
+ base_file_string = "Feature: Fake feature to parse\nScenario:\n* fake step\n"
41
+ source_text = base_file_string + source_text
42
+
43
+ parsed_file = Parsing::parse_text(source_text)
44
+
45
+ parsed_file.first['elements'].first['steps'].first['rows'].first
46
+ end
47
+
48
+ def build_row(parsed_row)
49
+ populate_element_source_line(parsed_row)
50
+ populate_row_cells(parsed_row)
51
+ populate_raw_element(parsed_row)
52
+ end
53
+
54
+ def populate_row_cells(parsed_row)
55
+ @cells = parsed_row['cells']
56
+ end
57
+
58
+ end
59
+ end
@@ -1,3 +1,3 @@
1
1
  module CucumberAnalytics
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
3
3
  end
@@ -35,19 +35,19 @@ describe 'Background, Integration' do
35
35
  it 'can get its directory' do
36
36
  directory = @background.get_ancestor(:directory)
37
37
 
38
- directory.path.should == @directory.path
38
+ directory.should equal @directory
39
39
  end
40
40
 
41
41
  it 'can get its feature file' do
42
42
  feature_file = @background.get_ancestor(:feature_file)
43
43
 
44
- feature_file.path.should == @directory.feature_files.first.path
44
+ feature_file.should equal @directory.feature_files.first
45
45
  end
46
46
 
47
47
  it 'can get its feature' do
48
48
  feature = @background.get_ancestor(:feature)
49
49
 
50
- feature.name.should == @directory.feature_files.first.features.first.name
50
+ feature.should equal @directory.feature_files.first.features.first
51
51
  end
52
52
 
53
53
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -35,7 +35,7 @@ describe 'Directory, Integration' do
35
35
  it 'can get its directory' do
36
36
  directory = @nested_directory.get_ancestor(:directory)
37
37
 
38
- directory.path.should == @directory.path
38
+ directory.should equal @directory
39
39
  end
40
40
 
41
41
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -29,31 +29,31 @@ describe 'DocString, Integration' do
29
29
  it 'can get its directory' do
30
30
  directory = @doc_string.get_ancestor(:directory)
31
31
 
32
- directory.path.should == @directory.path
32
+ directory.should equal @directory
33
33
  end
34
34
 
35
35
  it 'can get its feature file' do
36
36
  feature_file = @doc_string.get_ancestor(:feature_file)
37
37
 
38
- feature_file.path.should == @directory.feature_files.first.path
38
+ feature_file.should equal @directory.feature_files.first
39
39
  end
40
40
 
41
41
  it 'can get its feature' do
42
42
  feature = @doc_string.get_ancestor(:feature)
43
43
 
44
- feature.name.should == @directory.feature_files.first.features.first.name
44
+ feature.should equal @directory.feature_files.first.features.first
45
45
  end
46
46
 
47
47
  it 'can get its test' do
48
48
  test = @doc_string.get_ancestor(:test)
49
49
 
50
- test.name.should == @directory.feature_files.first.features.first.tests.first.name
50
+ test.should equal @directory.feature_files.first.features.first.tests.first
51
51
  end
52
52
 
53
53
  it 'can get its step' do
54
54
  step = @doc_string.get_ancestor(:step)
55
55
 
56
- step.base.should == @directory.feature_files.first.features.first.tests.first.steps.first.base
56
+ step.should equal @directory.feature_files.first.features.first.tests.first.steps.first
57
57
  end
58
58
 
59
59
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -42,25 +42,25 @@ describe 'Example, Integration' do
42
42
  it 'can get its directory' do
43
43
  directory = @example.get_ancestor(:directory)
44
44
 
45
- directory.path.should == @directory.path
45
+ directory.should equal @directory
46
46
  end
47
47
 
48
48
  it 'can get its feature file' do
49
49
  feature_file = @example.get_ancestor(:feature_file)
50
50
 
51
- feature_file.path.should == @directory.feature_files.first.path
51
+ feature_file.should equal @directory.feature_files.first
52
52
  end
53
53
 
54
54
  it 'can get its feature' do
55
55
  feature = @example.get_ancestor(:feature)
56
56
 
57
- feature.name.should == @directory.feature_files.first.features.first.name
57
+ feature.should equal @directory.feature_files.first.features.first
58
58
  end
59
59
 
60
60
  it 'can get its test' do
61
61
  test = @example.get_ancestor(:test)
62
62
 
63
- test.name.should == @directory.feature_files.first.features.first.tests.first.name
63
+ test.should equal @directory.feature_files.first.features.first.tests.first
64
64
  end
65
65
 
66
66
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -31,7 +31,7 @@ describe 'FeatureFile, Integration' do
31
31
  it 'can get its directory' do
32
32
  directory = @feature_file.get_ancestor(:directory)
33
33
 
34
- directory.path.should == @directory.path
34
+ directory.should equal @directory
35
35
  end
36
36
 
37
37
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -104,13 +104,13 @@ describe 'Feature, Integration' do
104
104
  it 'can get its directory' do
105
105
  directory = @feature.get_ancestor(:directory)
106
106
 
107
- directory.path.should == @directory.path
107
+ directory.should equal @directory
108
108
  end
109
109
 
110
110
  it 'can get its feature file' do
111
111
  feature_file = @feature.get_ancestor(:feature_file)
112
112
 
113
- feature_file.path.should == @directory.feature_files.first.path
113
+ feature_file.should equal @directory.feature_files.first
114
114
  end
115
115
 
116
116
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -45,19 +45,19 @@ describe 'Outline, Integration' do
45
45
  it 'can get its directory' do
46
46
  directory = @outline.get_ancestor(:directory)
47
47
 
48
- directory.path.should == @directory.path
48
+ directory.should equal @directory
49
49
  end
50
50
 
51
51
  it 'can get its feature file' do
52
52
  feature_file = @outline.get_ancestor(:feature_file)
53
53
 
54
- feature_file.path.should == @directory.feature_files.first.path
54
+ feature_file.should equal @directory.feature_files.first
55
55
  end
56
56
 
57
57
  it 'can get its feature' do
58
58
  feature = @outline.get_ancestor(:feature)
59
59
 
60
- feature.name.should == @directory.feature_files.first.features.first.name
60
+ feature.should equal @directory.feature_files.first.features.first
61
61
  end
62
62
 
63
63
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -39,19 +39,19 @@ describe 'Scenario, Integration' do
39
39
  it 'can get its directory' do
40
40
  directory = @scenario.get_ancestor(:directory)
41
41
 
42
- directory.path.should == @directory.path
42
+ directory.should equal @directory
43
43
  end
44
44
 
45
45
  it 'can get its feature file' do
46
46
  feature_file = @scenario.get_ancestor(:feature_file)
47
47
 
48
- feature_file.path.should == @directory.feature_files.first.path
48
+ feature_file.should equal @directory.feature_files.first
49
49
  end
50
50
 
51
51
  it 'can get its feature' do
52
52
  feature = @scenario.get_ancestor(:feature)
53
53
 
54
- feature.name.should == @directory.feature_files.first.features.first.name
54
+ feature.should equal @directory.feature_files.first.features.first
55
55
  end
56
56
 
57
57
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -133,25 +133,25 @@ describe 'Step, Integration' do
133
133
  it 'can get its directory' do
134
134
  directory = @step.get_ancestor(:directory)
135
135
 
136
- directory.path.should == @directory.path
136
+ directory.should equal @directory
137
137
  end
138
138
 
139
139
  it 'can get its feature file' do
140
140
  feature_file = @step.get_ancestor(:feature_file)
141
141
 
142
- feature_file.path.should == @directory.feature_files.first.path
142
+ feature_file.should equal @directory.feature_files.first
143
143
  end
144
144
 
145
145
  it 'can get its feature' do
146
146
  feature = @step.get_ancestor(:feature)
147
147
 
148
- feature.name.should == @directory.feature_files.first.features.first.name
148
+ feature.should equal @directory.feature_files.first.features.first
149
149
  end
150
150
 
151
151
  it 'can get its test' do
152
152
  test = @step.get_ancestor(:test)
153
153
 
154
- test.name.should == @directory.feature_files.first.features.first.tests.first.name
154
+ test.should equal @directory.feature_files.first.features.first.tests.first
155
155
  end
156
156
 
157
157
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+
3
+ SimpleCov.command_name('Table') unless RUBY_VERSION.to_s < '1.9.0'
4
+
5
+ describe 'Table, Integration' do
6
+
7
+ it 'properly sets its child elements' do
8
+ source = ['| cell 1 |',
9
+ '| cell 2 |']
10
+ source = source.join("\n")
11
+
12
+ table = CucumberAnalytics::Table.new(source)
13
+ row_1 = table.row_elements[0]
14
+ row_2 = table.row_elements[1]
15
+
16
+ row_1.parent_element.should equal table
17
+ row_2.parent_element.should equal table
18
+ end
19
+
20
+ context 'getting stuff' do
21
+
22
+ before(:each) do
23
+ source = ['Feature: Test feature',
24
+ '',
25
+ ' Scenario: Test test',
26
+ ' * a step:',
27
+ ' | a | table |']
28
+ source = source.join("\n")
29
+
30
+ file_path = "#{@default_file_directory}/table_row_test_file.feature"
31
+ File.open(file_path, 'w') { |file| file.write(source) }
32
+
33
+ @directory = CucumberAnalytics::Directory.new(@default_file_directory)
34
+ @table = @directory.feature_files.first.features.first.tests.first.steps.first.block
35
+ end
36
+
37
+
38
+ it 'can get its directory' do
39
+ directory = @table.get_ancestor(:directory)
40
+
41
+ directory.should equal @directory
42
+ end
43
+
44
+ it 'can get its feature file' do
45
+ feature_file = @table.get_ancestor(:feature_file)
46
+
47
+ feature_file.should equal @directory.feature_files.first
48
+ end
49
+
50
+ it 'can get its feature' do
51
+ feature = @table.get_ancestor(:feature)
52
+
53
+ feature.should equal @directory.feature_files.first.features.first
54
+ end
55
+
56
+ it 'can get its test' do
57
+ test = @table.get_ancestor(:test)
58
+
59
+ test.should equal @directory.feature_files.first.features.first.tests.first
60
+ end
61
+
62
+ it 'can get its step' do
63
+ step = @table.get_ancestor(:step)
64
+
65
+ step.should equal @directory.feature_files.first.features.first.tests.first.steps.first
66
+ end
67
+
68
+ it 'returns nil if it does not have the requested type of ancestor' do
69
+ example = @table.get_ancestor(:example)
70
+
71
+ example.should be_nil
72
+ end
73
+
74
+ end
75
+ end
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+
3
+ SimpleCov.command_name('TableRow') unless RUBY_VERSION.to_s < '1.9.0'
4
+
5
+ describe 'TableRow, Integration' do
6
+
7
+ context 'getting stuff' do
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
+
17
+ file_path = "#{@default_file_directory}/table_row_test_file.feature"
18
+ File.open(file_path, 'w') { |file| file.write(source) }
19
+
20
+ @directory = CucumberAnalytics::Directory.new(@default_file_directory)
21
+ @table_row = @directory.feature_files.first.features.first.tests.first.steps.first.block.row_elements.first
22
+ end
23
+
24
+
25
+ it 'can get its directory' do
26
+ directory = @table_row.get_ancestor(:directory)
27
+
28
+ directory.should equal @directory
29
+ end
30
+
31
+ it 'can get its feature file' do
32
+ feature_file = @table_row.get_ancestor(:feature_file)
33
+
34
+ feature_file.should equal @directory.feature_files.first
35
+ end
36
+
37
+ it 'can get its feature' do
38
+ feature = @table_row.get_ancestor(:feature)
39
+
40
+ feature.should equal @directory.feature_files.first.features.first
41
+ end
42
+
43
+ it 'can get its test' do
44
+ test = @table_row.get_ancestor(:test)
45
+
46
+ test.should equal @directory.feature_files.first.features.first.tests.first
47
+ end
48
+
49
+ it 'can get its step' do
50
+ step = @table_row.get_ancestor(:step)
51
+
52
+ step.should equal @directory.feature_files.first.features.first.tests.first.steps.first
53
+ end
54
+
55
+ it 'can get its table' do
56
+ table = @table_row.get_ancestor(:table)
57
+
58
+ table.should equal @directory.feature_files.first.features.first.tests.first.steps.first.block
59
+ end
60
+
61
+ it 'returns nil if it does not have the requested type of ancestor' do
62
+ example = @table_row.get_ancestor(:example)
63
+
64
+ example.should be_nil
65
+ end
66
+
67
+ end
68
+ end
@@ -30,31 +30,31 @@ describe 'Tag, Integration' do
30
30
  it 'can get its directory' do
31
31
  directory = @tag.get_ancestor(:directory)
32
32
 
33
- directory.path.should == @directory.path
33
+ directory.should equal @directory
34
34
  end
35
35
 
36
36
  it 'can get its feature file' do
37
37
  feature_file = @tag.get_ancestor(:feature_file)
38
38
 
39
- feature_file.path.should == @directory.feature_files.first.path
39
+ feature_file.should equal @directory.feature_files.first
40
40
  end
41
41
 
42
42
  it 'can get its feature' do
43
43
  feature = @tag.get_ancestor(:feature)
44
44
 
45
- feature.name.should == @directory.feature_files.first.features.first.name
45
+ feature.should equal @directory.feature_files.first.features.first
46
46
  end
47
47
 
48
48
  it 'can get its test' do
49
49
  test = @tag.get_ancestor(:test)
50
50
 
51
- test.name.should == @directory.feature_files.first.features.first.tests.first.name
51
+ test.should equal @directory.feature_files.first.features.first.tests.first
52
52
  end
53
53
 
54
54
  it 'can get its example' do
55
55
  example = @tag.get_ancestor(:example)
56
56
 
57
- example.name.should == @directory.feature_files.first.features.first.tests.first.examples.first.name
57
+ example.should equal @directory.feature_files.first.features.first.tests.first.examples.first
58
58
  end
59
59
 
60
60
  it 'returns nil if it does not have the requested type of ancestor' do
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ SimpleCov.command_name('TableRow') unless RUBY_VERSION.to_s < '1.9.0'
4
+
5
+ describe 'TableRow, Unit' do
6
+
7
+ clazz = CucumberAnalytics::TableRow
8
+
9
+ it_should_behave_like 'a nested element', clazz
10
+ it_should_behave_like 'a bare bones element', clazz
11
+ it_should_behave_like 'a prepopulated element', clazz
12
+ it_should_behave_like 'a sourced element', clazz
13
+ it_should_behave_like 'a raw element', clazz
14
+
15
+ it 'can be parsed from stand alone text' do
16
+ source = '| a | row |'
17
+
18
+ expect { @element = clazz.new(source) }.to_not raise_error
19
+
20
+ # Sanity check in case instantiation failed in a non-explosive manner
21
+ @element.cells.should == ['a', 'row']
22
+ end
23
+
24
+ before(:each) do
25
+ @row = clazz.new
26
+ end
27
+
28
+ it 'has cells' do
29
+ @row.should respond_to(:cells)
30
+ end
31
+
32
+ it 'can get and set its cells' do
33
+ @row.cells = :some_cells
34
+ @row.cells.should == :some_cells
35
+ @row.cells = :some_other_cells
36
+ @row.cells.should == :some_other_cells
37
+ end
38
+
39
+ it 'starts with no cells' do
40
+ @row.cells.should == []
41
+ end
42
+
43
+ end
@@ -39,6 +39,21 @@ describe 'Table, Unit' do
39
39
  @table.contents.should == []
40
40
  end
41
41
 
42
+ it 'has row elements' do
43
+ @table.should respond_to(:row_elements)
44
+ end
45
+
46
+ it 'can get and set its row elements' do
47
+ @table.row_elements = :some_row_elements
48
+ @table.row_elements.should == :some_row_elements
49
+ @table.row_elements = :some_other_row_elements
50
+ @table.row_elements.should == :some_other_row_elements
51
+ end
52
+
53
+ it 'starts with no row elements' do
54
+ @table.row_elements.should == []
55
+ end
56
+
42
57
  it 'stores its contents as a nested array of strings' do
43
58
  source = "| cell 1 | cell 2 |\n| cell 3 | cell 4 |"
44
59
  table = CucumberAnalytics::Table.new(source)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kessler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-03 00:00:00.000000000 Z
11
+ date: 2013-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gherkin
@@ -114,6 +114,7 @@ files:
114
114
  - features/modeling/scenario_modeling.feature
115
115
  - features/modeling/step_modeling.feature
116
116
  - features/modeling/table_modeling.feature
117
+ - features/modeling/table_row_modeling.feature
117
118
  - features/modeling/tag_modeling.feature
118
119
  - features/step_definitions/background_steps.rb
119
120
  - features/step_definitions/directory_steps.rb
@@ -148,6 +149,7 @@ files:
148
149
  - lib/cucumber_analytics/sourceable.rb
149
150
  - lib/cucumber_analytics/step.rb
150
151
  - lib/cucumber_analytics/table.rb
152
+ - lib/cucumber_analytics/table_row.rb
151
153
  - lib/cucumber_analytics/tag.rb
152
154
  - lib/cucumber_analytics/taggable.rb
153
155
  - lib/cucumber_analytics/test_element.rb
@@ -162,6 +164,8 @@ files:
162
164
  - spec/integration/outline_integration_spec.rb
163
165
  - spec/integration/scenario_integration_spec.rb
164
166
  - spec/integration/step_integration_spec.rb
167
+ - spec/integration/table_integration_spec.rb
168
+ - spec/integration/table_row_integration_spec.rb
165
169
  - spec/integration/tag_integration_spec.rb
166
170
  - spec/integration/world_integration_spec.rb
167
171
  - spec/spec_helper.rb
@@ -187,6 +191,7 @@ files:
187
191
  - spec/unit/sourceable_unit_spec.rb
188
192
  - spec/unit/sourced_element_unit_specs.rb
189
193
  - spec/unit/step_unit_spec.rb
194
+ - spec/unit/table_row_unit_spec.rb
190
195
  - spec/unit/table_unit_spec.rb
191
196
  - spec/unit/tag_unit_spec.rb
192
197
  - spec/unit/taggable_unit_spec.rb
@@ -239,6 +244,7 @@ test_files:
239
244
  - features/modeling/scenario_modeling.feature
240
245
  - features/modeling/step_modeling.feature
241
246
  - features/modeling/table_modeling.feature
247
+ - features/modeling/table_row_modeling.feature
242
248
  - features/modeling/tag_modeling.feature
243
249
  - features/step_definitions/background_steps.rb
244
250
  - features/step_definitions/directory_steps.rb
@@ -264,6 +270,8 @@ test_files:
264
270
  - spec/integration/outline_integration_spec.rb
265
271
  - spec/integration/scenario_integration_spec.rb
266
272
  - spec/integration/step_integration_spec.rb
273
+ - spec/integration/table_integration_spec.rb
274
+ - spec/integration/table_row_integration_spec.rb
267
275
  - spec/integration/tag_integration_spec.rb
268
276
  - spec/integration/world_integration_spec.rb
269
277
  - spec/spec_helper.rb
@@ -289,6 +297,7 @@ test_files:
289
297
  - spec/unit/sourceable_unit_spec.rb
290
298
  - spec/unit/sourced_element_unit_specs.rb
291
299
  - spec/unit/step_unit_spec.rb
300
+ - spec/unit/table_row_unit_spec.rb
292
301
  - spec/unit/table_unit_spec.rb
293
302
  - spec/unit/tag_unit_spec.rb
294
303
  - spec/unit/taggable_unit_spec.rb