cuke_modeler 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.travis.yml +23 -0
  2. data/Gemfile +22 -4
  3. data/History.rdoc +6 -0
  4. data/Rakefile +26 -26
  5. data/cuke_modeler.gemspec +3 -1
  6. data/features/modeling/{background_modeling.feature → gherkin/background_modeling.feature} +1 -11
  7. data/features/modeling/{background_output.feature → gherkin/background_output.feature} +1 -0
  8. data/features/modeling/{directory_modeling.feature → gherkin/directory_modeling.feature} +1 -11
  9. data/features/modeling/{directory_output.feature → gherkin/directory_output.feature} +1 -0
  10. data/features/modeling/{doc_string_modeling.feature → gherkin/doc_string_modeling.feature} +1 -11
  11. data/features/modeling/{doc_string_output.feature → gherkin/doc_string_output.feature} +1 -0
  12. data/features/modeling/{example_modeling.feature → gherkin/example_modeling.feature} +1 -11
  13. data/features/modeling/{example_output.feature → gherkin/example_output.feature} +1 -0
  14. data/features/modeling/{feature_file_modeling.feature → gherkin/feature_file_modeling.feature} +1 -11
  15. data/features/modeling/{feature_file_output.feature → gherkin/feature_file_output.feature} +1 -0
  16. data/features/modeling/{feature_modeling.feature → gherkin/feature_modeling.feature} +1 -11
  17. data/features/modeling/{feature_output.feature → gherkin/feature_output.feature} +1 -0
  18. data/features/modeling/{outline_modeling.feature → gherkin/outline_modeling.feature} +1 -11
  19. data/features/modeling/{outline_output.feature → gherkin/outline_output.feature} +1 -0
  20. data/features/modeling/{row_modeling.feature → gherkin/row_modeling.feature} +1 -10
  21. data/features/modeling/{row_output.feature → gherkin/row_output.feature} +1 -0
  22. data/features/modeling/{scenario_modeling.feature → gherkin/scenario_modeling.feature} +1 -11
  23. data/features/modeling/{scenario_output.feature → gherkin/scenario_output.feature} +1 -0
  24. data/features/modeling/{step_modeling.feature → gherkin/step_modeling.feature} +1 -11
  25. data/features/modeling/{step_output.feature → gherkin/step_output.feature} +1 -0
  26. data/features/modeling/{table_modeling.feature → gherkin/table_modeling.feature} +1 -11
  27. data/features/modeling/{table_output.feature → gherkin/table_output.feature} +1 -0
  28. data/features/modeling/{table_row_modeling.feature → gherkin/table_row_modeling.feature} +1 -11
  29. data/features/modeling/{table_row_output.feature → gherkin/table_row_output.feature} +1 -0
  30. data/features/modeling/{tag_modeling.feature → gherkin/tag_modeling.feature} +1 -11
  31. data/features/modeling/{tag_output.feature → gherkin/tag_output.feature} +1 -0
  32. data/features/modeling/gherkin3/background_modeling.feature +64 -0
  33. data/features/modeling/gherkin3/background_output.feature +131 -0
  34. data/features/modeling/gherkin3/directory_modeling.feature +110 -0
  35. data/features/modeling/gherkin3/directory_output.feature +14 -0
  36. data/features/modeling/gherkin3/doc_string_modeling.feature +53 -0
  37. data/features/modeling/gherkin3/doc_string_output.feature +72 -0
  38. data/features/modeling/gherkin3/example_modeling.feature +100 -0
  39. data/features/modeling/gherkin3/example_output.feature +207 -0
  40. data/features/modeling/gherkin3/feature_file_modeling.feature +54 -0
  41. data/features/modeling/gherkin3/feature_file_output.feature +14 -0
  42. data/features/modeling/gherkin3/feature_modeling.feature +155 -0
  43. data/features/modeling/gherkin3/feature_output.feature +249 -0
  44. data/features/modeling/gherkin3/outline_modeling.feature +89 -0
  45. data/features/modeling/gherkin3/outline_output.feature +255 -0
  46. data/features/modeling/gherkin3/row_modeling.feature +68 -0
  47. data/features/modeling/gherkin3/row_output.feature +28 -0
  48. data/features/modeling/gherkin3/scenario_modeling.feature +78 -0
  49. data/features/modeling/gherkin3/scenario_output.feature +148 -0
  50. data/features/modeling/gherkin3/step_modeling.feature +75 -0
  51. data/features/modeling/gherkin3/step_output.feature +53 -0
  52. data/features/modeling/gherkin3/table_modeling.feature +42 -0
  53. data/features/modeling/gherkin3/table_output.feature +43 -0
  54. data/features/modeling/gherkin3/table_row_modeling.feature +57 -0
  55. data/features/modeling/gherkin3/table_row_output.feature +28 -0
  56. data/features/modeling/gherkin3/tag_modeling.feature +49 -0
  57. data/features/modeling/gherkin3/tag_output.feature +17 -0
  58. data/features/step_definitions/background_steps.rb +5 -1
  59. data/features/step_definitions/doc_string_steps.rb +5 -1
  60. data/features/step_definitions/feature_steps.rb +5 -1
  61. data/features/step_definitions/outline_steps.rb +10 -4
  62. data/features/step_definitions/step_steps.rb +10 -2
  63. data/features/step_definitions/table_steps.rb +6 -2
  64. data/features/step_definitions/tag_steps.rb +15 -3
  65. data/features/step_definitions/test_steps.rb +7 -2
  66. data/features/support/env.rb +21 -9
  67. data/gemfiles/gherkin.gemfile +17 -0
  68. data/gemfiles/gherkin3.gemfile +15 -0
  69. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +146 -0
  70. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +206 -0
  71. data/lib/cuke_modeler/parsing.rb +61 -20
  72. data/lib/cuke_modeler/raw.rb +1 -1
  73. data/lib/cuke_modeler/row.rb +2 -2
  74. data/lib/cuke_modeler/table.rb +2 -2
  75. data/lib/cuke_modeler/table_row.rb +1 -1
  76. data/lib/cuke_modeler/version.rb +1 -1
  77. data/spec/integration/example_integration_spec.rb +2 -1
  78. data/spec/integration/feature_integration_spec.rb +7 -4
  79. data/spec/integration/outline_integration_spec.rb +4 -2
  80. data/spec/integration/tag_integration_spec.rb +2 -1
  81. data/spec/spec_helper.rb +6 -0
  82. data/spec/unit/background_unit_spec.rb +17 -0
  83. data/spec/unit/doc_string_unit_spec.rb +17 -0
  84. data/spec/unit/example_unit_spec.rb +18 -1
  85. data/spec/unit/feature_file_unit_spec.rb +2 -2
  86. data/spec/unit/feature_unit_spec.rb +16 -0
  87. data/spec/unit/outline_unit_spec.rb +20 -1
  88. data/spec/unit/row_unit_spec.rb +18 -0
  89. data/spec/unit/scenario_unit_spec.rb +17 -0
  90. data/spec/unit/step_unit_spec.rb +17 -0
  91. data/spec/unit/table_row_unit_spec.rb +18 -0
  92. data/spec/unit/table_unit_spec.rb +16 -0
  93. data/spec/unit/tag_unit_spec.rb +17 -0
  94. metadata +147 -60
  95. data/features/step_definitions/spec_steps.rb +0 -18
@@ -0,0 +1,23 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.6
7
+ - 2.2.2
8
+
9
+ gemfile:
10
+ - gemfiles/gherkin.gemfile
11
+ - gemfiles/gherkin3.gemfile
12
+
13
+
14
+ matrix:
15
+ exclude:
16
+ - rvm: 1.8.7
17
+ gemfile: gemfiles/gherkin3.gemfile
18
+
19
+ # todo - Remove this once TravisCI fixes their bundler issue (https://github.com/alphagov/govuk_template/pull/186)
20
+ before_install:
21
+ - gem install bundler -v 1.9.10
22
+
23
+ script: bundle exec rake cuke_modeler:ci_build
data/Gemfile CHANGED
@@ -1,4 +1,22 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in cuke_modeler.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cuke_modeler.gemspec
4
+ gemspec
5
+
6
+ # cuke_modeler can play with pretty much any version of these but they all play differently with Ruby
7
+ if RUBY_VERSION =~ /^1\.8/
8
+ gem 'cucumber', '<1.3.0'
9
+ gem 'gherkin', '<2.12.0'
10
+ gem 'mime-types', '<2.0.0'
11
+ gem 'rest-client', '<1.7.0'
12
+ elsif RUBY_VERSION =~ /^1\./
13
+ gem 'cucumber', '<2.0.0'
14
+ end
15
+
16
+ if RUBY_VERSION =~ /^2\./
17
+ gem 'gherkin', '>= 3.0.0'
18
+ end
19
+
20
+ if RUBY_VERSION =~ /^2\.[23456789]/
21
+ gem 'test-unit'
22
+ end
@@ -1,8 +1,14 @@
1
+ === Version 0.1.0 / 2016-02-10
2
+
3
+ * Support for version 3.0 of the 'gherkin' gem added.
4
+
5
+
1
6
  === Version 0.0.2 / 2015-11-22
2
7
 
3
8
  * Bug fix - Fixed a bug that was causing object comparison using #== to not work when comparing some models to other
4
9
  types of objects.
5
10
 
11
+
6
12
  === Version 0.0.1 / 2014-06-02
7
13
 
8
14
  * Initial release
data/Rakefile CHANGED
@@ -1,38 +1,38 @@
1
1
  require "bundler/gem_tasks"
2
- require 'cucumber/rake/task'
3
- require 'rspec/core/rake_task'
2
+ require 'coveralls/rake/task'
4
3
 
4
+ require 'racatt'
5
5
 
6
- def set_cucumber_options(options)
7
- ENV['CUCUMBER_OPTS'] = options
8
- end
9
6
 
10
- def combine_options(set_1, set_2)
11
- set_2 ? "#{set_1} #{set_2}" : set_1
12
- end
7
+ namespace 'cuke_modeler' do
13
8
 
9
+ task :clear_coverage do
10
+ code_coverage_directory = "#{File.dirname(__FILE__)}/coverage"
14
11
 
15
- task :clear_coverage do
16
- code_coverage_directory = "#{File.dirname(__FILE__)}/coverage"
12
+ FileUtils.remove_dir(code_coverage_directory, true)
13
+ end
17
14
 
18
- FileUtils.remove_dir(code_coverage_directory, true)
19
- end
20
15
 
21
- desc 'Run all Cucumber tests for the gem'
22
- task :tests, [:options] do |t, args|
23
- set_cucumber_options(combine_options("-t ~@wip -t ~@off -f progress", args[:options]))
24
- end
25
- Cucumber::Rake::Task.new(:tests)
16
+ Racatt.create_tasks
26
17
 
27
- desc 'Run all RSpec tests for the gem'
28
- RSpec::Core::RakeTask.new(:specs) do |t|
29
- t.rspec_opts = "-t ~wip -t ~off"
30
- end
18
+ # Redefining the task from 'racatt' in order to clear the code coverage results
19
+ task :test_everything => :clear_coverage
20
+
21
+
22
+ # The task that CI will use
23
+ Coveralls::RakeTask.new
24
+ task :ci_build => [:smart_test, 'coveralls:push']
25
+
26
+ desc 'Test gem based on Ruby/dependency versions'
27
+ task :smart_test do |t, args|
28
+ rspec_args = ''
29
+ cucumber_args = Gem.loaded_specs['gherkin'].version.version[/^3/] ? '-t ~@gherkin' : '-t ~@gherkin3'
30
+ cucumber_args += ' -f progress'
31
+
32
+ Rake::Task['cuke_modeler:test_everything'].invoke(rspec_args, cucumber_args)
33
+ end
31
34
 
32
- desc 'Run All The Things'
33
- task :everything => :clear_coverage do
34
- Rake::Task[:specs].invoke
35
- Rake::Task[:tests].invoke('-t ~@redundant')
36
35
  end
37
36
 
38
- task :default => :everything
37
+
38
+ task :default => 'cuke_modeler:smart_test'
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_runtime_dependency('gherkin')
20
+ spec.add_runtime_dependency 'gherkin', '< 4.0'
21
21
  spec.add_runtime_dependency('json', '~> 1.0')
22
22
  spec.add_runtime_dependency('multi_json', '~> 1.0')
23
23
 
@@ -26,4 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'cucumber'
27
27
  spec.add_development_dependency 'rspec', '~> 2.14.0'
28
28
  spec.add_development_dependency 'simplecov'
29
+ spec.add_development_dependency 'racatt', '~> 1.0'
30
+ spec.add_development_dependency 'coveralls'
29
31
  end
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Background elements can be modeled.
2
3
 
3
4
 
@@ -62,14 +63,3 @@ Feature: Background elements can be modeled.
62
63
 
63
64
  Scenario: Convenient output of a background
64
65
  Then the background has convenient output
65
-
66
- @redundant
67
- Scenario Outline: Background models pass all other specifications
68
- Exact specifications detailing the API for background models.
69
- Given that there are "<additional specifications>" detailing models
70
- When the corresponding specifications are run
71
- Then all of those specifications are met
72
- Examples:
73
- | additional specifications |
74
- | background_unit_spec.rb |
75
- | background_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting background elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Directories can be modeled.
2
3
 
3
4
 
@@ -107,14 +108,3 @@ Feature: Directories can be modeled.
107
108
 
108
109
  Scenario: Convenient output of a directory
109
110
  Then the directory has convenient output
110
-
111
- @redundant
112
- Scenario Outline: Directory models pass all other specifications
113
- Exact specifications detailing the API for directory models.
114
- Given that there are "<additional specifications>" detailing models
115
- When the corresponding specifications are run
116
- Then all of those specifications are met
117
- Examples:
118
- | additional specifications |
119
- | directory_unit_spec.rb |
120
- | directory_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting directory elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Doc string elements can be modeled.
2
3
 
3
4
 
@@ -50,14 +51,3 @@ Feature: Doc string elements can be modeled.
50
51
 
51
52
  Scenario: Convenient output of an a doc string
52
53
  Then the doc string has convenient output
53
-
54
- @redundant
55
- Scenario Outline: Doc string models pass all other specifications
56
- Exact specifications detailing the API for doc string models.
57
- Given that there are "<additional specifications>" detailing models
58
- When the corresponding specifications are run
59
- Then all of those specifications are met
60
- Examples:
61
- | additional specifications |
62
- | doc_string_unit_spec.rb |
63
- | doc_string_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting doc string elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Example elements can be modeled.
2
3
 
3
4
 
@@ -98,14 +99,3 @@ Feature: Example elements can be modeled.
98
99
 
99
100
  Scenario: Convenient output of an example block
100
101
  Then the example block has convenient output
101
-
102
- @redundant
103
- Scenario Outline: Example models pass all other specifications
104
- Exact specifications detailing the API for example block models.
105
- Given that there are "<additional specifications>" detailing models
106
- When the corresponding specifications are run
107
- Then all of those specifications are met
108
- Examples:
109
- | additional specifications |
110
- | example_unit_spec.rb |
111
- | example_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting example elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Feature files can be modeled.
2
3
 
3
4
 
@@ -51,14 +52,3 @@ Feature: Feature files can be modeled.
51
52
 
52
53
  Scenario: Convenient output of a feature file
53
54
  Then the feature file has convenient output
54
-
55
- @redundant
56
- Scenario Outline: Feature file models pass all other specifications
57
- Exact specifications detailing the API for .feature file models.
58
- Given that there are "<additional specifications>" detailing models
59
- When the corresponding specifications are run
60
- Then all of those specifications are met
61
- Examples:
62
- | additional specifications |
63
- | feature_file_unit_spec.rb |
64
- | feature_file_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting feature file elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Features can be modeled.
2
3
 
3
4
 
@@ -151,14 +152,3 @@ Feature: Features can be modeled.
151
152
 
152
153
  Scenario: Convenient output of a feature
153
154
  Then the feature has convenient output
154
-
155
- @redundant
156
- Scenario Outline: Feature models pass all other specifications
157
- Exact specifications detailing the API for feature models.
158
- Given that there are "<additional specifications>" detailing models
159
- When the corresponding specifications are run
160
- Then all of those specifications are met
161
- Examples:
162
- | additional specifications |
163
- | feature_unit_spec.rb |
164
- | feature_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting feature elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outline elements can be modeled.
2
3
 
3
4
 
@@ -87,14 +88,3 @@ Feature: Outline elements can be modeled.
87
88
 
88
89
  Scenario: Convenient output of an an outline
89
90
  Then the outline has convenient output
90
-
91
- @redundant
92
- Scenario Outline: Outline models pass all other specifications
93
- Exact specifications detailing the API for outline models.
94
- Given that there are "<additional specifications>" detailing models
95
- When the corresponding specifications are run
96
- Then all of those specifications are met
97
- Examples:
98
- | additional specifications |
99
- | outline_unit_spec.rb |
100
- | outline_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting outline elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Row elements can be modeled.
2
3
 
3
4
 
@@ -65,13 +66,3 @@ Feature: Row elements can be modeled.
65
66
 
66
67
  Scenario: Convenient output of a row
67
68
  Then the row has convenient output
68
-
69
- @redundant
70
- Scenario Outline: Row models pass all other specifications
71
- Exact specifications detailing the API for Row models.
72
- Given that there are "<additional specifications>" detailing models
73
- When the corresponding specifications are run
74
- Then all of those specifications are met
75
- Examples:
76
- | additional specifications |
77
- | row_unit_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting row elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Scenario elements can be modeled.
2
3
 
3
4
 
@@ -76,14 +77,3 @@ Feature: Scenario elements can be modeled.
76
77
 
77
78
  Scenario: Convenient output of a scenario
78
79
  Then the scenario has convenient output
79
-
80
- @redundant
81
- Scenario Outline: Scenario models pass all other specifications
82
- Exact specifications detailing the API for scenario models.
83
- Given that there are "<additional specifications>" detailing models
84
- When the corresponding specifications are run
85
- Then all of those specifications are met
86
- Examples:
87
- | additional specifications |
88
- | scenario_unit_spec.rb |
89
- | scenario_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting scenario elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Step elements can be modeled.
2
3
 
3
4
 
@@ -72,14 +73,3 @@ Feature: Step elements can be modeled.
72
73
 
73
74
  Scenario: Convenient output of a step
74
75
  Then the step has convenient output
75
-
76
- @redundant
77
- Scenario Outline: Step models pass all other specifications
78
- Exact specifications detailing the API for step models.
79
- Given that there are "<additional specifications>" detailing models
80
- When the corresponding specifications are run
81
- Then all of those specifications are met
82
- Examples:
83
- | additional specifications |
84
- | step_unit_spec.rb |
85
- | step_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting step elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Table elements can be modeled.
2
3
 
3
4
 
@@ -39,14 +40,3 @@ Feature: Table elements can be modeled.
39
40
 
40
41
  Scenario: Convenient output of a table
41
42
  Then the table has convenient output
42
-
43
- @redundant
44
- Scenario Outline: Table models pass all other specifications
45
- Exact specifications detailing the API for table models.
46
- Given that there are "<additional specifications>" detailing models
47
- When the corresponding specifications are run
48
- Then all of those specifications are met
49
- Examples:
50
- | additional specifications |
51
- | table_unit_spec.rb |
52
- | table_integration_spec.rb |
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Outputting table elements
2
3
 
3
4
  The output of an element model is a representation of the element as it would
@@ -1,3 +1,4 @@
1
+ @gherkin
1
2
  Feature: Table Row elements can be modeled.
2
3
 
3
4
 
@@ -54,14 +55,3 @@ Feature: Table Row elements can be modeled.
54
55
 
55
56
  Scenario: Convenient output of a table row
56
57
  Then the table row has convenient output
57
-
58
- @redundant
59
- Scenario Outline: Table row models pass all other specifications
60
- Exact specifications detailing the API for table table row models.
61
- Given that there are "<additional specifications>" detailing models
62
- When the corresponding specifications are run
63
- Then all of those specifications are met
64
- Examples:
65
- | additional specifications |
66
- | table_row_unit_spec.rb |
67
- | table_row_integration_spec.rb |