rapid-core 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. data/.gitignore +7 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +11 -0
  4. data/Gemfile.lock +53 -0
  5. data/Rakefile +61 -0
  6. data/cucumber.yml +3 -0
  7. data/doc/plan.txt +89 -0
  8. data/doc/scaffold/controller.rb +83 -0
  9. data/doc/scaffold/helper.rb +2 -0
  10. data/doc/scaffold/model.rb +5 -0
  11. data/doc/scaffold/rapid_scaffold.rb +5 -0
  12. data/doc/scaffold/views/_form.html.erb +25 -0
  13. data/doc/scaffold/views/edit.html.erb +6 -0
  14. data/doc/scaffold/views/index.html.erb +25 -0
  15. data/doc/scaffold/views/new.html.erb +5 -0
  16. data/doc/scaffold/views/show.html.erb +15 -0
  17. data/features/settings/boolean/default.feature +36 -0
  18. data/features/settings/double-nested/default.feature +50 -0
  19. data/features/settings/double-nested/if.feature +41 -0
  20. data/features/settings/double-nested/unless.feature +39 -0
  21. data/features/settings/double-nested/validates/exclusion_of.feature +30 -0
  22. data/features/settings/double-nested/validates/format_of.feature +30 -0
  23. data/features/settings/double-nested/validates/inclusion_of.feature +30 -0
  24. data/features/settings/double-nested/validates/length_of.feature +30 -0
  25. data/features/settings/double-nested/validates/presence_of.feature +37 -0
  26. data/features/settings/double-nested/validates/size_of.feature +30 -0
  27. data/features/settings/integer/default.feature +49 -0
  28. data/features/settings/nested/default.feature +50 -0
  29. data/features/settings/nested/if.feature +53 -0
  30. data/features/settings/nested/unless.feature +32 -0
  31. data/features/settings/nested/validates/exclusion_of.feature +30 -0
  32. data/features/settings/nested/validates/format_of.feature +30 -0
  33. data/features/settings/nested/validates/inclusion_of.feature +30 -0
  34. data/features/settings/nested/validates/length_of.feature +30 -0
  35. data/features/settings/nested/validates/presence_of.feature +37 -0
  36. data/features/settings/nested/validates/size_of.feature +30 -0
  37. data/features/settings/not_found.feature +33 -0
  38. data/features/settings/string/default.feature +36 -0
  39. data/features/settings/string/validates/exclusion_of.feature +30 -0
  40. data/features/settings/string/validates/format_of.feature +30 -0
  41. data/features/settings/string/validates/inclusion_of.feature +30 -0
  42. data/features/settings/string/validates/length_of.feature +30 -0
  43. data/features/settings/string/validates/presence_of.feature +37 -0
  44. data/features/settings/string/validates/size_of.feature +30 -0
  45. data/features/step_definitions/settings_steps.rb +92 -0
  46. data/features/step_definitions/skeleton_steps.rb +68 -0
  47. data/features/step_definitions/template_steps.rb +39 -0
  48. data/features/support/env.rb +6 -0
  49. data/features/templates/comment_if.feature +55 -0
  50. data/features/templates/comment_unless.feature +56 -0
  51. data/features/templates/for/for.feature +51 -0
  52. data/features/templates/if/else.feature +60 -0
  53. data/features/templates/if/elsif.feature +82 -0
  54. data/features/templates/if/if.feature +55 -0
  55. data/features/templates/namespaces/exist.feature +54 -0
  56. data/features/templates/static.feature +37 -0
  57. data/features/templates/variables.feature +61 -0
  58. data/lib/rapid/check.rb +162 -0
  59. data/lib/rapid/core.rb +37 -0
  60. data/lib/rapid/error.rb +84 -0
  61. data/lib/rapid/module.rb +35 -0
  62. data/lib/rapid/railtie.rb +18 -0
  63. data/lib/rapid/setting/base.rb +35 -0
  64. data/lib/rapid/setting/boolean_setting.rb +17 -0
  65. data/lib/rapid/setting/class_hash.rb +34 -0
  66. data/lib/rapid/setting/comments.rb +25 -0
  67. data/lib/rapid/setting/definer.rb +151 -0
  68. data/lib/rapid/setting/instance_hash.rb +132 -0
  69. data/lib/rapid/setting/instance_root.rb +107 -0
  70. data/lib/rapid/setting/integer_setting.rb +24 -0
  71. data/lib/rapid/setting/namespace/base.rb +113 -0
  72. data/lib/rapid/setting/namespace/instance.rb +84 -0
  73. data/lib/rapid/setting/nested_validations.rb +86 -0
  74. data/lib/rapid/setting/string_setting.rb +13 -0
  75. data/lib/rapid/settings.rb +129 -0
  76. data/lib/rapid/skeleton/base.rb +164 -0
  77. data/lib/rapid/skeleton/helpers/directory.rb +53 -0
  78. data/lib/rapid/skeleton/helpers/gem.rb +133 -0
  79. data/lib/rapid/skeleton/helpers/migration.rb +46 -0
  80. data/lib/rapid/skeleton/helpers/route.rb +115 -0
  81. data/lib/rapid/skeleton/helpers/script.rb +33 -0
  82. data/lib/rapid/skeleton/helpers/template.rb +73 -0
  83. data/lib/rapid/skeleton/helpers/view.rb +35 -0
  84. data/lib/rapid/spec/template.rb +104 -0
  85. data/lib/rapid/spec.rb +1 -0
  86. data/lib/rapid/tasks.rb +29 -0
  87. data/lib/rapid/template/base.rb +49 -0
  88. data/lib/rapid/template/node/base.rb +43 -0
  89. data/lib/rapid/template/node/comment_node.rb +42 -0
  90. data/lib/rapid/template/node/if_node.rb +109 -0
  91. data/lib/rapid/template/node/root.rb +51 -0
  92. data/lib/rapid/template/node/static.rb +29 -0
  93. data/lib/rapid/template/node/variable.rb +86 -0
  94. data/lib/rapid/template/parser.rb +167 -0
  95. data/lib/rapid/template/pulling/base.rb +91 -0
  96. data/lib/rapid/template/pulling/explicit.rb +92 -0
  97. data/lib/rapid/template/pulling/forgiving.rb +58 -0
  98. data/lib/rapid/version.rb +3 -0
  99. data/lib/rapid.rb +37 -0
  100. data/rapid-core.gemspec +26 -0
  101. data/spec/rapid/check_spec.rb +119 -0
  102. data/spec/rapid/error_spec.rb +14 -0
  103. data/spec/rapid/module_spec.rb +28 -0
  104. data/spec/rapid/setting/base_spec.rb +17 -0
  105. data/spec/rapid/setting/definer_spec.rb +318 -0
  106. data/spec/rapid/setting/instance_root_spec.rb +161 -0
  107. data/spec/rapid/setting/namespace/base_spec.rb +93 -0
  108. data/spec/rapid/setting/namespace/instance_spec.rb +12 -0
  109. data/spec/rapid/setting/nested_validations_spec.rb +72 -0
  110. data/spec/rapid/settings_spec.rb +51 -0
  111. data/spec/rapid/skeleton/base_spec.rb +224 -0
  112. data/spec/rapid/skeleton/helpers/directory_spec.rb +104 -0
  113. data/spec/rapid/skeleton/helpers/gem_spec.rb +180 -0
  114. data/spec/rapid/skeleton/helpers/migration_spec.rb +23 -0
  115. data/spec/rapid/skeleton/helpers/route_spec.rb +120 -0
  116. data/spec/rapid/skeleton/helpers/script_spec.rb +57 -0
  117. data/spec/rapid/skeleton/helpers/template_spec.rb +142 -0
  118. data/spec/rapid/skeleton/helpers/view_spec.rb +54 -0
  119. data/spec/rapid/spec/template_spec.rb +168 -0
  120. data/spec/rapid/template/base_spec.rb +290 -0
  121. data/spec/rapid/template/node/base_spec.rb +9 -0
  122. data/spec/rapid/template/node/comment_node_spec.rb +46 -0
  123. data/spec/rapid/template/node/if_node_spec.rb +28 -0
  124. data/spec/rapid/template/node/root_spec.rb +9 -0
  125. data/spec/rapid/template/node/static_spec.rb +17 -0
  126. data/spec/rapid/template/node/variable_spec.rb +87 -0
  127. data/spec/rapid/template/parser_spec.rb +187 -0
  128. data/spec/rapid/template/pulling/base_spec.rb +81 -0
  129. data/spec/rapid/template/pulling/explicit_spec.rb +33 -0
  130. data/spec/rapid/template/pulling/forgiving_spec.rb +132 -0
  131. data/spec/spec_helper.rb +10 -0
  132. metadata +325 -0
@@ -0,0 +1,30 @@
1
+ Feature: nested validates_length_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string "app.author.name"
10
+
11
+ validates_length_of "app.author.name", :minimum => 3
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Valid value
17
+ When I load:
18
+ """
19
+ app.author.name: Dan
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Invalid value
25
+ When I load:
26
+ """
27
+ app.author.name: Me
28
+ """
29
+ Then "app.author.name" should have a "is too short (minimum is 3 characters)" error
30
+ And vice versa
@@ -0,0 +1,37 @@
1
+ Feature: validates_presence_of nested settings
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string "app.author.name"
10
+
11
+ validates_presence_of "app.author.name"
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Non-blank value
17
+ When I load:
18
+ """
19
+ app.author.name: Dan
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: nil value
25
+ When I load:
26
+ """
27
+ """
28
+ Then "app.author.name" should have a "can't be blank" error
29
+ And vice versa
30
+
31
+ Scenario: blank value
32
+ When I load:
33
+ """
34
+ app.author.name:
35
+ """
36
+ Then "app.author.name" should have a "can't be blank" error
37
+ And vice versa
@@ -0,0 +1,30 @@
1
+ Feature: nested validates_size_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string "app.author.name"
10
+
11
+ validates_size_of "app.author.name", :minimum => 3
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Valid value
17
+ When I load:
18
+ """
19
+ app.author.name: Dan
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Invalid value
25
+ When I load:
26
+ """
27
+ app.author.name: Me
28
+ """
29
+ Then "app.author.name" should have a "is too short (minimum is 3 characters)" error
30
+ And vice versa
@@ -0,0 +1,49 @@
1
+ Feature: Default integer
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.integer :max_users
10
+
11
+ end
12
+ """
13
+
14
+ Scenario: Non-blank value
15
+ When I load:
16
+ """
17
+ max_users: 5
18
+ """
19
+ Then I should be good
20
+ And vice versa
21
+
22
+ Scenario: Invalid value
23
+ When I load:
24
+ """
25
+ max_users: hi
26
+ """
27
+ Then "max_users" should have a "doesn't allow values of that type" error
28
+
29
+ Scenario: decimal value
30
+ When I load:
31
+ """
32
+ max_users: 2.5
33
+ """
34
+ Then "max_users" should have a "doesn't allow values of that type" error
35
+
36
+ Scenario: nil value
37
+ When I load:
38
+ """
39
+ """
40
+ Then I should be good
41
+ And vice versa
42
+
43
+ Scenario: blank value
44
+ When I load:
45
+ """
46
+ max_users:
47
+ """
48
+ Then I should be good
49
+ And vice versa
@@ -0,0 +1,50 @@
1
+ Feature: Default single nesting
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string "app.name"
10
+
11
+ end
12
+ """
13
+
14
+ Scenario: Non-blank value
15
+ When I load:
16
+ """
17
+ app.name: Rapid
18
+ """
19
+ Then I should be good
20
+ And vice versa
21
+
22
+ Scenario: nil value
23
+ When I load:
24
+ """
25
+ """
26
+ Then I should be good
27
+ And vice versa
28
+
29
+ Scenario: nil nested value
30
+ When I load:
31
+ """
32
+ app:
33
+ """
34
+ Then I should be good
35
+ # And vice versa # TODO
36
+
37
+ Scenario: blank value
38
+ When I load:
39
+ """
40
+ app.name:
41
+ """
42
+ Then I should be good
43
+ And vice versa
44
+
45
+ Scenario: integer value
46
+ When I load:
47
+ """
48
+ app: 1
49
+ """
50
+ Then "app" should have a "doesn't allow values of that type" error
@@ -0,0 +1,53 @@
1
+ Feature: nested validates with an if parameter
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string 'app.author.name'
10
+ setting.string 'app.name'
11
+
12
+ validates_presence_of "app.author.name", :if => "_root.app.name"
13
+
14
+ end
15
+ """
16
+
17
+ Scenario: Valid value
18
+ When I load:
19
+ """
20
+ app.name: Rapid
21
+ app.author.name: Dan
22
+ """
23
+ Then I should be good
24
+ And vice versa
25
+
26
+ Scenario: Invalid value
27
+ When I load:
28
+ """
29
+ app.name: Dan
30
+ """
31
+ Then "app.author.name" should have a "can't be blank" error
32
+ And vice versa
33
+
34
+ Scenario: across namespaces
35
+ Given settings "my_settings2.rb":
36
+ """
37
+ class MySettings2
38
+ include Rapid::Settings
39
+
40
+ setting.string 'author.name'
41
+ setting.string 'app.name'
42
+
43
+ validates_presence_of "author.name", :if => "_root.app.name"
44
+
45
+ end
46
+ """
47
+ When I load:
48
+ """
49
+ app.name: Rapid
50
+ """
51
+ Then "author.name" should have a "can't be blank" error
52
+ And vice versa
53
+
@@ -0,0 +1,32 @@
1
+ Feature: nested validates with an unless parameter
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string 'app.author.name'
10
+ setting.string 'app.name'
11
+
12
+ validates_presence_of "app.author.name", :unless => "_root.app.name"
13
+
14
+ end
15
+ """
16
+
17
+ Scenario: Valid value
18
+ When I load:
19
+ """
20
+ app.name: Rapid
21
+ app.author.name: Dan
22
+ """
23
+ Then I should be good
24
+ And vice versa
25
+
26
+ Scenario: Invalid value
27
+ When I load:
28
+ """
29
+
30
+ """
31
+ Then "app.author.name" should have a "can't be blank" error
32
+ And vice versa
@@ -0,0 +1,30 @@
1
+ Feature: nested validates_exclusion_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string 'app.name'
10
+
11
+ validates_exclusion_of "app.name", :in => %w(test)
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Valid value
17
+ When I load:
18
+ """
19
+ app.name: Dan
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Invalid value
25
+ When I load:
26
+ """
27
+ app.name: test
28
+ """
29
+ Then "app.name" should have a "is reserved" error
30
+ And vice versa
@@ -0,0 +1,30 @@
1
+ Feature: nested validates_format_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string 'app.version'
10
+
11
+ validates_format_of 'app.version', :with => /^[0-9]+\.[0-9]+$/
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Valid value
17
+ When I load:
18
+ """
19
+ app.version: "1.0"
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Invalid value
25
+ When I load:
26
+ """
27
+ app.version: 1.0a
28
+ """
29
+ Then "app.version" should have a "is invalid" error
30
+ And vice versa
@@ -0,0 +1,30 @@
1
+ Feature: nested validates_inclusion_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string 'app.version'
10
+
11
+ validates_inclusion_of 'app.version', :in => %w(1.0 1.1)
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Included value
17
+ When I load:
18
+ """
19
+ app.version: "1.0"
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Non-included value
25
+ When I load:
26
+ """
27
+ app.version: "2.0"
28
+ """
29
+ Then "app.version" should have a "is not included in the list" error
30
+ And vice versa
@@ -0,0 +1,30 @@
1
+ Feature: nested validates_length_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string "app.name"
10
+
11
+ validates_length_of "app.name", :minimum => 3
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Valid value
17
+ When I load:
18
+ """
19
+ app.name: Dan
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Invalid value
25
+ When I load:
26
+ """
27
+ app.name: Me
28
+ """
29
+ Then "app.name" should have a "is too short (minimum is 3 characters)" error
30
+ And vice versa
@@ -0,0 +1,37 @@
1
+ Feature: validates_presence_of nested settings
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string "app.name"
10
+
11
+ validates_presence_of "app.name"
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Non-blank value
17
+ When I load:
18
+ """
19
+ app.name: Dan
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: nil value
25
+ When I load:
26
+ """
27
+ """
28
+ Then "app.name" should have a "can't be blank" error
29
+ And vice versa
30
+
31
+ Scenario: blank value
32
+ When I load:
33
+ """
34
+ app.name:
35
+ """
36
+ Then "app.name" should have a "can't be blank" error
37
+ And vice versa
@@ -0,0 +1,30 @@
1
+ Feature: nested validates_size_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string "app.name"
10
+
11
+ validates_size_of "app.name", :minimum => 3
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Valid value
17
+ When I load:
18
+ """
19
+ app.name: Dan
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Invalid value
25
+ When I load:
26
+ """
27
+ app.name: Me
28
+ """
29
+ Then "app.name" should have a "is too short (minimum is 3 characters)" error
30
+ And vice versa
@@ -0,0 +1,33 @@
1
+ Feature: Settings handling not found cases
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string :name
10
+
11
+ end
12
+ """
13
+
14
+ Scenario: Referencing a setting that does not exist
15
+ When I load:
16
+ """
17
+ author: Dan
18
+ """
19
+ Then "author" should have a "can't be found" error
20
+
21
+ Scenario: Referencing a setting under a namespace that doesn't exist
22
+ When I load:
23
+ """
24
+ app.author: Dan
25
+ """
26
+ Then "app" should have a "can't be found" error
27
+
28
+ Scenario: Incorrectly treating a setting is a namespace
29
+ When I load:
30
+ """
31
+ name.version: 1.0
32
+ """
33
+ Then "name" should have a "doesn't allow values of that type" error
@@ -0,0 +1,36 @@
1
+ Feature: Default string
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string :name
10
+
11
+ end
12
+ """
13
+
14
+ Scenario: Non-blank value
15
+ When I load:
16
+ """
17
+ name: Dan
18
+ """
19
+ Then I should be good
20
+ And vice versa
21
+
22
+ Scenario: nil value
23
+ When I load:
24
+ """
25
+ """
26
+ Then I should be good
27
+ And vice versa
28
+
29
+ Scenario: blank value
30
+ When I load:
31
+ """
32
+ name:
33
+ """
34
+ Then I should be good
35
+ And vice versa
36
+
@@ -0,0 +1,30 @@
1
+ Feature: string validates_exclusion_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string :name
10
+
11
+ validates_exclusion_of :name, :in => %w(test)
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Valid value
17
+ When I load:
18
+ """
19
+ name: Dan
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Invalid value
25
+ When I load:
26
+ """
27
+ name: test
28
+ """
29
+ Then "name" should have a "is reserved" error
30
+ And vice versa
@@ -0,0 +1,30 @@
1
+ Feature: string validates_format_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string :version
10
+
11
+ validates_format_of :version, :with => /^[0-9]+\.[0-9]+$/
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Valid value
17
+ When I load:
18
+ """
19
+ version: "1.0"
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Invalid value
25
+ When I load:
26
+ """
27
+ version: 1.0a
28
+ """
29
+ Then "version" should have a "is invalid" error
30
+ And vice versa
@@ -0,0 +1,30 @@
1
+ Feature: string validates_inclusion_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string :version
10
+
11
+ validates_inclusion_of :version, :in => %w(1.0 1.1)
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Included value
17
+ When I load:
18
+ """
19
+ version: "1.0"
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Non-included value
25
+ When I load:
26
+ """
27
+ version: "2.0"
28
+ """
29
+ Then "version" should have a "is not included in the list" error
30
+ And vice versa
@@ -0,0 +1,30 @@
1
+ Feature: string validates_length_of
2
+
3
+ Background:
4
+ Given settings "my_settings.rb":
5
+ """
6
+ class MySettings
7
+ include Rapid::Settings
8
+
9
+ setting.string :name
10
+
11
+ validates_length_of :name, :minimum => 3
12
+
13
+ end
14
+ """
15
+
16
+ Scenario: Valid value
17
+ When I load:
18
+ """
19
+ name: Dan
20
+ """
21
+ Then I should be good
22
+ And vice versa
23
+
24
+ Scenario: Invalid value
25
+ When I load:
26
+ """
27
+ name: Me
28
+ """
29
+ Then "name" should have a "is too short (minimum is 3 characters)" error
30
+ And vice versa