cuke_modeler 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 329eb638d9b52dada19e21e6753722e0400d3991
4
- data.tar.gz: dfb9d2bd435da763e2d0f909c68e3b36e7f30a98
3
+ metadata.gz: 75c21d56686546ac790c590dda83628ca4eadd92
4
+ data.tar.gz: 6094f26c8873cfbf4040318ca163a34370432f20
5
5
  SHA512:
6
- metadata.gz: d5e6e71f9dd644940330211fda900bf879f6451c4965b7265f197740784342d26c6a26fac59d3ef77e7a02382fa61ddfc085a1b31641ead50ace3f473e98c64b
7
- data.tar.gz: 67da157b4e93b31a719b60a3ab191c2eaca7b324bc64d6bfd5d3fa62d7f7fb32ff8391319b787fe0116fd89470287911fb8f1ac6d74714fdef328631d54b287c
6
+ metadata.gz: 78783c9af83fb27735e80bc5f327320224e6ee53260fed2ad89dbf925c4086eb6baac5c2bcbd0157ba6f93f3601b6a9d560c47a68437baa56eee779810d21ff3
7
+ data.tar.gz: d55ff4646b883721cba7cd0d0210657f39e874cf10a8795ba85061c026dbe4851edce5197d3c2f0ed977273a258959eda9f8276baedf5c54c1db0d10fef8a06e
data/History.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### Version 1.1.1 / 2016-10-28
2
+
3
+ * Bug fix - Abstract instantiation of models when using a non-default dialect
4
+ now works correctly.
5
+
6
+
1
7
  ### Version 1.1.0 / 2016-10-28
2
8
 
3
9
  * Support added for non-English dialects. This gem should now be able to model
data/README.md CHANGED
@@ -73,6 +73,28 @@ an entire test suite!
73
73
  For more information on the different models and how to use them, see the
74
74
  [documentation](http://www.relishapp.com/enkessler/CukeModeler/docs).
75
75
 
76
+ ## Modeling dialects other than English
77
+
78
+ The modeling functionality provided by this gem will work with any dialect that
79
+ is supported by the **gherkin** gem. For modeling at the feature level or higher,
80
+ no additional effort is needed because the `# language` header at the top of a
81
+ feature already indicates that a non-default dialect is being used.
82
+
83
+ # language: en-au
84
+ Pretty much: An 'Australian' feature
85
+
86
+ Aww, look mate: An 'Australian' scenario
87
+ * a step
88
+
89
+ In order to model smaller portions of Gherkin, however, the parser will need
90
+ to be told what dialect is being used.
91
+
92
+ # Setting the dialect to 'Australian'
93
+ CukeModeler::Parsing.dialect = 'en-au'
94
+
95
+ gherkin = "Awww, look mate: some test\n* a step"
96
+ test = CukeModeler::Scenario.new(gherkin)
97
+
76
98
 
77
99
  ## Modeling other versions of Cucumber
78
100
 
@@ -83,7 +105,7 @@ that feature is ultimately run with SpecFlow (Cucumber for C#), Lettuce
83
105
  (Cucumber for Python), or some other flavor of Cucumber.
84
106
 
85
107
 
86
- ### Other gems that are (or soon will be) powered by cuke_modeler
108
+ ### Other gems that are (or soon will be) powered by **cuke_modeler**
87
109
 
88
110
  * [cql](https://github.com/enkessler/cql)
89
111
  * [cuketagger](https://github.com/enkessler/cuketagger)
@@ -59,7 +59,7 @@ module CukeModeler
59
59
 
60
60
 
61
61
  def parse_source(source_text)
62
- base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n"
62
+ base_file_string = "# language: #{Parsing.dialect}\n#{dialect_feature_keyword}: Fake feature to parse\n"
63
63
  source_text = base_file_string + source_text
64
64
 
65
65
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_background.feature')
@@ -36,7 +36,7 @@ module CukeModeler
36
36
 
37
37
 
38
38
  def parse_source(source_text)
39
- base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} fake step\n"
39
+ base_file_string = "# language: #{Parsing.dialect}\n#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} fake step\n"
40
40
  source_text = base_file_string + '|' + source_text + '|'
41
41
 
42
42
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_cell.feature')
@@ -40,7 +40,7 @@ module CukeModeler
40
40
 
41
41
 
42
42
  def parse_source(source_text)
43
- base_file_string = "#{dialect_feature_keyword}:\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} step\n"
43
+ base_file_string = "# language: #{Parsing.dialect}\n#{dialect_feature_keyword}:\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} step\n"
44
44
  source_text = base_file_string + source_text
45
45
 
46
46
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_doc_string.feature')
@@ -119,7 +119,7 @@ module CukeModeler
119
119
 
120
120
 
121
121
  def parse_source(source_text)
122
- base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_outline_keyword}:\n#{dialect_step_keyword} fake step\n"
122
+ base_file_string = "# language: #{Parsing.dialect}\n#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_outline_keyword}:\n#{dialect_step_keyword} fake step\n"
123
123
  source_text = base_file_string + source_text
124
124
 
125
125
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_example.feature')
@@ -67,7 +67,7 @@ module CukeModeler
67
67
 
68
68
 
69
69
  def parse_source(source_text)
70
- base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n"
70
+ base_file_string = "# language: #{Parsing.dialect}\n#{dialect_feature_keyword}: Fake feature to parse\n"
71
71
  source_text = base_file_string + source_text
72
72
 
73
73
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_outline.feature')
@@ -38,7 +38,7 @@ module CukeModeler
38
38
 
39
39
 
40
40
  def parse_source(source_text)
41
- base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} fake step\n"
41
+ base_file_string = "# language: #{Parsing.dialect}\n#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} fake step\n"
42
42
  source_text = base_file_string + source_text
43
43
 
44
44
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_row.feature')
@@ -62,7 +62,7 @@ module CukeModeler
62
62
 
63
63
 
64
64
  def parse_source(source_text)
65
- base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n"
65
+ base_file_string = "# language: #{Parsing.dialect}\n#{dialect_feature_keyword}: Fake feature to parse\n"
66
66
  source_text = base_file_string + source_text
67
67
 
68
68
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_scenario.feature')
@@ -57,7 +57,7 @@ module CukeModeler
57
57
 
58
58
 
59
59
  def parse_source(source_text)
60
- base_file_string = "#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_scenario_keyword}:\n"
60
+ base_file_string = "# language: #{Parsing.dialect}\n#{dialect_feature_keyword}: Fake feature to parse\n#{dialect_scenario_keyword}:\n"
61
61
  source_text = base_file_string + source_text
62
62
 
63
63
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_step.feature')
@@ -42,7 +42,7 @@ module CukeModeler
42
42
 
43
43
 
44
44
  def parse_source(source_text)
45
- base_file_string = "#{dialect_feature_keyword}:\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} step\n"
45
+ base_file_string = "# language: #{Parsing.dialect}\n#{dialect_feature_keyword}:\n#{dialect_scenario_keyword}:\n#{dialect_step_keyword} step\n"
46
46
  source_text = base_file_string + source_text
47
47
 
48
48
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_table.feature')
@@ -36,7 +36,7 @@ module CukeModeler
36
36
 
37
37
  def parse_source(source_text)
38
38
  base_file_string = "\n#{dialect_feature_keyword}: Fake feature to parse"
39
- source_text = source_text + base_file_string
39
+ source_text = "# language: #{Parsing.dialect}\n" + source_text + base_file_string
40
40
 
41
41
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_tag.feature')
42
42
 
@@ -1,4 +1,4 @@
1
1
  module CukeModeler
2
2
  # The gem version
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
@@ -20,6 +20,23 @@ describe 'Background, Integration' do
20
20
  expect { clazz.new(source) }.to_not raise_error
21
21
  end
22
22
 
23
+ it 'can parse text that uses a non-default dialect' do
24
+ original_dialect = CukeModeler::Parsing.dialect
25
+ CukeModeler::Parsing.dialect = 'en-au'
26
+
27
+ begin
28
+ source_text = 'First off: Background name'
29
+
30
+ expect { @model = clazz.new(source_text) }.to_not raise_error
31
+
32
+ # Sanity check in case modeling failed in a non-explosive manner
33
+ expect(@model.name).to eq('Background name')
34
+ ensure
35
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
36
+ CukeModeler::Parsing.dialect = original_dialect
37
+ end
38
+ end
39
+
23
40
  it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
24
41
  background = clazz.new("#{@background_keyword}: test background\ndescription\n#{@step_keyword} a step")
25
42
  data = background.parsing_data
@@ -21,6 +21,23 @@ describe 'Cell, Integration' do
21
21
  expect { clazz.new(source) }.to_not raise_error
22
22
  end
23
23
 
24
+ it 'can parse text that uses a non-default dialect' do
25
+ original_dialect = CukeModeler::Parsing.dialect
26
+ CukeModeler::Parsing.dialect = 'en-au'
27
+
28
+ begin
29
+ source_text = 'foo'
30
+
31
+ expect { @model = clazz.new(source_text) }.to_not raise_error
32
+
33
+ # Sanity check in case modeling failed in a non-explosive manner
34
+ expect(@model.value).to eq('foo')
35
+ ensure
36
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
37
+ CukeModeler::Parsing.dialect = original_dialect
38
+ end
39
+ end
40
+
24
41
  it 'provides a descriptive filename when being parsed from stand alone text' do
25
42
  source = "not a \n cell"
26
43
 
@@ -20,6 +20,23 @@ describe 'DocString, Integration' do
20
20
  expect { clazz.new(source) }.to_not raise_error
21
21
  end
22
22
 
23
+ it 'can parse text that uses a non-default dialect' do
24
+ original_dialect = CukeModeler::Parsing.dialect
25
+ CukeModeler::Parsing.dialect = 'en-au'
26
+
27
+ begin
28
+ source_text = "\"\"\"\ntext foo\n\"\"\""
29
+
30
+ expect { @model = clazz.new(source_text) }.to_not raise_error
31
+
32
+ # Sanity check in case modeling failed in a non-explosive manner
33
+ expect(@model.content).to eq('text foo')
34
+ ensure
35
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
36
+ CukeModeler::Parsing.dialect = original_dialect
37
+ end
38
+ end
39
+
23
40
  it 'provides a descriptive filename when being parsed from stand alone text' do
24
41
  source = 'bad doc string text'
25
42
 
@@ -36,6 +36,25 @@ describe 'Example, Integration' do
36
36
  expect { @model = clazz.new(source) }.to_not raise_error
37
37
  end
38
38
 
39
+ it 'can parse text that uses a non-default dialect' do
40
+ original_dialect = CukeModeler::Parsing.dialect
41
+ CukeModeler::Parsing.dialect = 'en-au'
42
+
43
+ begin
44
+ source_text = "You'll wanna:
45
+ | param |
46
+ | value |"
47
+
48
+ expect { @model = clazz.new(source_text) }.to_not raise_error
49
+
50
+ # Sanity check in case modeling failed in a non-explosive manner
51
+ expect(@model.rows.first.cells.first.value).to eq('param')
52
+ ensure
53
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
54
+ CukeModeler::Parsing.dialect = original_dialect
55
+ end
56
+ end
57
+
39
58
  it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
40
59
  example = clazz.new("@tag\n#{@example_keyword}: test example\ndescription\n|param|\n|value|")
41
60
  data = example.parsing_data
@@ -21,6 +21,24 @@ describe 'Feature, Integration' do
21
21
  expect { clazz.new(source) }.to_not raise_error
22
22
  end
23
23
 
24
+ it 'can parse text that uses a non-default dialect' do
25
+ original_dialect = CukeModeler::Parsing.dialect
26
+ CukeModeler::Parsing.dialect = 'en-au'
27
+
28
+ begin
29
+ source_text = "# language: en-au
30
+ Pretty much: Feature name"
31
+
32
+ expect { @model = clazz.new(source_text) }.to_not raise_error
33
+
34
+ # Sanity check in case modeling failed in a non-explosive manner
35
+ expect(@model.name).to eq('Feature name')
36
+ ensure
37
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
38
+ CukeModeler::Parsing.dialect = original_dialect
39
+ end
40
+ end
41
+
24
42
  it 'provides a descriptive filename when being parsed from stand alone text' do
25
43
  source = 'bad feature text'
26
44
 
@@ -36,6 +36,27 @@ describe 'Outline, Integration' do
36
36
  expect { clazz.new(source) }.to_not raise_error
37
37
  end
38
38
 
39
+ it 'can parse text that uses a non-default dialect' do
40
+ original_dialect = CukeModeler::Parsing.dialect
41
+ CukeModeler::Parsing.dialect = 'en-au'
42
+
43
+ begin
44
+ source_text = "Reckon it's like: Outline name
45
+ Yeah nah zen
46
+ You'll wanna:
47
+ | param |
48
+ | value |"
49
+
50
+ expect { @model = clazz.new(source_text) }.to_not raise_error
51
+
52
+ # Sanity check in case modeling failed in a non-explosive manner
53
+ expect(@model.name).to eq('Outline name')
54
+ ensure
55
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
56
+ CukeModeler::Parsing.dialect = original_dialect
57
+ end
58
+ end
59
+
39
60
  it 'stores the original data generated by the parsing adapter', :gherkin4 => true do
40
61
  outline = clazz.new("@tag\n#{@outline_keyword}: test outline\ndescription\n#{@step_keyword} a step\n#{@example_keyword}:\n|param|\n|value|")
41
62
  data = outline.parsing_data
@@ -21,6 +21,23 @@ describe 'Row, Integration' do
21
21
  expect { clazz.new(source) }.to_not raise_error
22
22
  end
23
23
 
24
+ it 'can parse text that uses a non-default dialect' do
25
+ original_dialect = CukeModeler::Parsing.dialect
26
+ CukeModeler::Parsing.dialect = 'en-au'
27
+
28
+ begin
29
+ source_text = '| a | row |'
30
+
31
+ expect { @model = clazz.new(source_text) }.to_not raise_error
32
+
33
+ # Sanity check in case modeling failed in a non-explosive manner
34
+ expect(@model.cells.last.value).to eq('row')
35
+ ensure
36
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
37
+ CukeModeler::Parsing.dialect = original_dialect
38
+ end
39
+ end
40
+
24
41
  it 'provides a descriptive filename when being parsed from stand alone text' do
25
42
  source = " |bad |row| text| \n @foo "
26
43
 
@@ -48,7 +65,7 @@ describe 'Row, Integration' do
48
65
  data = example_row.parsing_data
49
66
 
50
67
  expect(data.keys).to match_array(['cells', 'line'])
51
- expect(data['line']).to eq(4)
68
+ expect(data['line']).to eq(5)
52
69
  end
53
70
 
54
71
  it 'properly sets its child models' do
@@ -20,6 +20,23 @@ describe 'Scenario, Integration' do
20
20
  expect { clazz.new(source) }.to_not raise_error
21
21
  end
22
22
 
23
+ it 'can parse text that uses a non-default dialect' do
24
+ original_dialect = CukeModeler::Parsing.dialect
25
+ CukeModeler::Parsing.dialect = 'en-au'
26
+
27
+ begin
28
+ source_text = 'Awww, look mate: Scenario name'
29
+
30
+ expect { @model = clazz.new(source_text) }.to_not raise_error
31
+
32
+ # Sanity check in case modeling failed in a non-explosive manner
33
+ expect(@model.name).to eq('Scenario name')
34
+ ensure
35
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
36
+ CukeModeler::Parsing.dialect = original_dialect
37
+ end
38
+ end
39
+
23
40
  it 'provides a descriptive filename when being parsed from stand alone text' do
24
41
  source = "bad scenario text \n #{@scenario_keyword}:\n And a step\n @foo "
25
42
 
@@ -20,6 +20,23 @@ describe 'Step, Integration' do
20
20
  expect { clazz.new(source) }.to_not raise_error
21
21
  end
22
22
 
23
+ it 'can parse text that uses a non-default dialect' do
24
+ original_dialect = CukeModeler::Parsing.dialect
25
+ CukeModeler::Parsing.dialect = 'en-au'
26
+
27
+ begin
28
+ source_text = "Y'know a step"
29
+
30
+ expect { @model = clazz.new(source_text) }.to_not raise_error
31
+
32
+ # Sanity check in case modeling failed in a non-explosive manner
33
+ expect(@model.keyword).to eq("Y'know")
34
+ ensure
35
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
36
+ CukeModeler::Parsing.dialect = original_dialect
37
+ end
38
+ end
39
+
23
40
  it 'provides a descriptive filename when being parsed from stand alone text' do
24
41
  source = "bad step text\n And a step\n @foo"
25
42
 
@@ -51,6 +51,23 @@ describe 'Table, Integration' do
51
51
  expect { clazz.new(source) }.to_not raise_error
52
52
  end
53
53
 
54
+ it 'can parse text that uses a non-default dialect' do
55
+ original_dialect = CukeModeler::Parsing.dialect
56
+ CukeModeler::Parsing.dialect = 'en-au'
57
+
58
+ begin
59
+ source_text = '| a table |'
60
+
61
+ expect { @model = clazz.new(source_text) }.to_not raise_error
62
+
63
+ # Sanity check in case modeling failed in a non-explosive manner
64
+ expect(@model.rows.first.cells.first.value).to eq('a table')
65
+ ensure
66
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
67
+ CukeModeler::Parsing.dialect = original_dialect
68
+ end
69
+ end
70
+
54
71
 
55
72
  describe 'model population' do
56
73
 
@@ -20,6 +20,23 @@ describe 'Tag, Integration' do
20
20
  expect { clazz.new(source) }.to_not raise_error
21
21
  end
22
22
 
23
+ it 'can parse text that uses a non-default dialect' do
24
+ original_dialect = CukeModeler::Parsing.dialect
25
+ CukeModeler::Parsing.dialect = 'en-au'
26
+
27
+ begin
28
+ source_text = '@foo'
29
+
30
+ expect { @model = clazz.new(source_text) }.to_not raise_error
31
+
32
+ # Sanity check in case modeling failed in a non-explosive manner
33
+ expect(@model.name).to eq('@foo')
34
+ ensure
35
+ # Making sure that our changes don't escape a test and ruin the rest of the suite
36
+ CukeModeler::Parsing.dialect = original_dialect
37
+ end
38
+ end
39
+
23
40
  it 'provides a descriptive filename when being parsed from stand alone text' do
24
41
  source = 'bad tag text'
25
42
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke_modeler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kessler