locomotivecms 3.0.0.rc3 → 3.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -3
  3. data/README.md +1 -1
  4. data/app/assets/stylesheets/locomotive/unauthorized/_public.scss +7 -4
  5. data/app/controllers/locomotive/errors_controller.rb +4 -0
  6. data/app/helpers/locomotive/errors_helper.rb +2 -4
  7. data/app/models/locomotive/concerns/content_entry/csv.rb +4 -0
  8. data/app/models/locomotive/concerns/content_entry/slug.rb +0 -2
  9. data/app/models/locomotive/concerns/content_type/sync.rb +2 -2
  10. data/app/models/locomotive/concerns/page/templatized.rb +1 -1
  11. data/app/models/locomotive/concerns/site/access_points.rb +3 -3
  12. data/app/models/locomotive/theme_asset.rb +0 -1
  13. data/app/views/locomotive/developers_documentation/_wagon.html.slim +2 -2
  14. data/app/views/locomotive/devise_mailer/reset_password_instructions.html.slim +1 -0
  15. data/app/views/locomotive/errors/no_site.json +1 -0
  16. data/app/views/locomotive/shared/_sidebar.html.slim +1 -1
  17. data/app/views/locomotive/shared/_sidebar_without_site.html.slim +1 -1
  18. data/app/views/locomotive/shared/header/_account_menu.html.slim +2 -2
  19. data/config/locales/en.yml +1 -1
  20. data/config/routes.rb +4 -2
  21. data/lib/generators/locomotive/install/install_generator.rb +9 -9
  22. data/lib/generators/locomotive/install/templates/carrierwave.rb +23 -12
  23. data/lib/generators/locomotive/install/templates/carrierwave_aws.rb +36 -0
  24. data/lib/generators/locomotive/install/templates/mongoid.yml +97 -35
  25. data/lib/locomotive/dependencies.rb +1 -1
  26. data/lib/locomotive/middlewares/site.rb +10 -4
  27. data/lib/locomotive/mongoid/patches.rb +1 -1
  28. data/lib/locomotive/steam_adaptor.rb +6 -4
  29. data/lib/locomotive/version.rb +1 -1
  30. data/spec/dummy/config/application.rb +0 -3
  31. data/spec/dummy/config/initializers/devise.rb +128 -58
  32. data/spec/dummy/config/mongoid.yml +95 -78
  33. data/spec/models/locomotive/content_entry_spec.rb +6 -6
  34. data/spec/requests/locomotive/steam/cache_spec.rb +1 -1
  35. data/spec/requests/site_spec.rb +25 -0
  36. data/spec/support/mongoid.rb +2 -0
  37. metadata +16 -189
  38. data/features/api/accounts.feature +0 -43
  39. data/features/api/authentication.feature +0 -41
  40. data/features/api/authorization/accounts.feature +0 -165
  41. data/features/api/authorization/content_assets.feature +0 -147
  42. data/features/api/authorization/content_entries.feature +0 -202
  43. data/features/api/authorization/content_types.feature +0 -237
  44. data/features/api/authorization/current_site.feature +0 -30
  45. data/features/api/authorization/memberships.feature +0 -225
  46. data/features/api/authorization/pages.feature +0 -189
  47. data/features/api/authorization/sites.feature +0 -212
  48. data/features/api/authorization/snippets.feature +0 -179
  49. data/features/api/authorization/theme_assets.feature +0 -185
  50. data/features/api/authorization/translations.feature +0 -253
  51. data/features/api/content_entries.feature +0 -184
  52. data/features/api/content_types.feature +0 -156
  53. data/features/api/editable_elements.feature +0 -190
  54. data/features/api/entries_custom_fields.feature +0 -150
  55. data/features/api/memberships.feature +0 -26
  56. data/features/api/pages.feature +0 -72
  57. data/features/backoffice/authorization/account_settings.feature +0 -28
  58. data/features/backoffice/authorization/content_type.feature +0 -35
  59. data/features/backoffice/authorization/current_site.feature +0 -53
  60. data/features/backoffice/authorization/inline_front_end_editing.feature +0 -46
  61. data/features/backoffice/authorization/pages.feature +0 -95
  62. data/features/backoffice/authorization/theme_assets.feature +0 -50
  63. data/features/backoffice/content_types/edit.feature +0 -20
  64. data/features/backoffice/content_types/email.feature +0 -26
  65. data/features/backoffice/content_types/has_many.feature +0 -80
  66. data/features/backoffice/content_types/integer.feature +0 -26
  67. data/features/backoffice/content_types/localized.feature +0 -63
  68. data/features/backoffice/content_types/many_to_many.feature +0 -70
  69. data/features/backoffice/content_types/tags.feature +0 -22
  70. data/features/backoffice/content_types/uniqueness.feature +0 -29
  71. data/features/backoffice/contents.feature +0 -93
  72. data/features/backoffice/editable_elements.feature +0 -22
  73. data/features/backoffice/installation.feature +0 -33
  74. data/features/backoffice/login.feature +0 -33
  75. data/features/backoffice/mounting.feature +0 -13
  76. data/features/backoffice/my_account.feature +0 -22
  77. data/features/backoffice/pages.feature +0 -73
  78. data/features/backoffice/regressions.feature +0 -19
  79. data/features/backoffice/site.feature +0 -71
  80. data/features/backoffice/snippets.feature +0 -39
  81. data/features/backoffice/theme_assets.feature +0 -72
  82. data/features/backoffice/translations.feature +0 -50
  83. data/features/public/basic.feature +0 -30
  84. data/features/public/contact_form.feature +0 -98
  85. data/features/public/content_entries.feature +0 -69
  86. data/features/public/editable_elements.feature +0 -138
  87. data/features/public/has_many.feature +0 -8
  88. data/features/public/inheritance.feature +0 -157
  89. data/features/public/inline_front_end_editing.feature +0 -26
  90. data/features/public/many_to_many.feature +0 -64
  91. data/features/public/new_contact_form.feature +0 -95
  92. data/features/public/pages.feature +0 -116
  93. data/features/public/pagination.feature +0 -8
  94. data/features/public/robots.feature +0 -22
  95. data/features/public/session.feature +0 -40
  96. data/features/public/sitemap.feature +0 -74
  97. data/features/public/snippets.feature +0 -21
  98. data/features/public/tablerow.feature +0 -42
  99. data/features/public/tags.feature +0 -45
  100. data/features/step_definitions/api_steps.rb +0 -179
  101. data/features/step_definitions/backoffice/mounting_steps.rb +0 -22
  102. data/features/step_definitions/backoffice_steps.rb +0 -47
  103. data/features/step_definitions/content_assets_steps.rb +0 -12
  104. data/features/step_definitions/content_types_steps.rb +0 -135
  105. data/features/step_definitions/current_site_steps.rb +0 -43
  106. data/features/step_definitions/editable_elements_steps.rb +0 -24
  107. data/features/step_definitions/membership_steps.rb +0 -19
  108. data/features/step_definitions/more_web_steps.rb +0 -131
  109. data/features/step_definitions/page_steps.rb +0 -133
  110. data/features/step_definitions/pagination_steps.rb +0 -35
  111. data/features/step_definitions/pickle_steps.rb +0 -100
  112. data/features/step_definitions/relationships_steps.rb +0 -110
  113. data/features/step_definitions/site_steps.rb +0 -111
  114. data/features/step_definitions/snippet_steps.rb +0 -37
  115. data/features/step_definitions/theme_asset_steps.rb +0 -64
  116. data/features/step_definitions/translation_steps.rb +0 -7
  117. data/features/step_definitions/web_steps.rb +0 -225
  118. data/features/step_definitions/within_steps.rb +0 -14
  119. data/features/support/cleaner.rb +0 -4
  120. data/features/support/env.rb +0 -82
  121. data/features/support/factory_girl.rb +0 -2
  122. data/features/support/http.rb +0 -22
  123. data/features/support/locales.rb +0 -5
  124. data/features/support/paths.rb +0 -62
  125. data/features/support/pickle.rb +0 -24
  126. data/features/support/selectors.rb +0 -57
@@ -1,179 +0,0 @@
1
- Feature: Snippets
2
- In order to ensure snippets are not tampered with
3
- As an admin, designer or author
4
- I will be restricted based on my role
5
-
6
- Background:
7
- Given I have the site: "test site" set up
8
- And a snippet named "My Snippet" with id "4f832c2cb0d86d3f42fffffe" and template:
9
- """
10
- My Snippet
11
- """
12
- And I have a designer and an author
13
-
14
- Scenario: As an unauthenticated user
15
- Given I am not authenticated
16
- When I do an API GET to snippets.json
17
- Then the JSON response at "error" should be "You need to sign in or sign up before continuing."
18
-
19
- # listing content types
20
-
21
- Scenario: Accessing snippets as an Admin
22
- Given I have an "admin" API token
23
- When I do an API GET request to snippets.json
24
- Then the JSON response should be an array
25
- And the JSON response should have 1 entry
26
-
27
- Scenario: Accessing snippets as a Designer
28
- Given I have a "designer" API token
29
- When I do an API GET request to snippets.json
30
- Then the JSON response should be an array
31
- And the JSON response should have 1 entry
32
-
33
- Scenario: Accessing snippets as an Author
34
- Given I have an "author" API token
35
- When I do an API GET request to snippets.json
36
- Then an access denied error should occur
37
-
38
- # showing snippet
39
-
40
- Scenario: Accessing snippet as an Admin
41
- Given I have an "admin" API token
42
- When I do an API GET request to snippets/4f832c2cb0d86d3f42fffffe.json
43
- Then the JSON response at "id" should be "4f832c2cb0d86d3f42fffffe"
44
- And the JSON response at "name" should be "My Snippet"
45
-
46
- Scenario: Accessing snippet as a Designer
47
- Given I have a "designer" API token
48
- When I do an API GET request to snippets/4f832c2cb0d86d3f42fffffe.json
49
- Then the JSON response at "id" should be "4f832c2cb0d86d3f42fffffe"
50
- And the JSON response at "name" should be "My Snippet"
51
-
52
- Scenario: Accessing snippet as an Author
53
- Given I have an "author" API token
54
- When I do an API GET request to snippets/4f832c2cb0d86d3f42fffffe.json
55
- Then an access denied error should occur
56
-
57
- # create snippet
58
-
59
- Scenario: Creating new snippet as an Admin
60
- Given I have an "admin" API token
61
- When I do an API GET request to snippets.json
62
- Then the JSON response should be an array
63
- And the JSON response should have 1 entry
64
- When I do an API POST to snippets.json with:
65
- """
66
- {
67
- "snippet": {
68
- "name": "Another snippet",
69
- "template": "<h1>Another Snippet!</h1>"
70
- }
71
- }
72
- """
73
- When I do an API GET request to snippets.json
74
- Then the JSON response should be an array
75
- And the JSON response should have 2 entries
76
- And the JSON should have the following:
77
- | 0/name | "Another snippet" |
78
- | 0/template | "<h1>Another Snippet!</h1>" |
79
-
80
- Scenario: Creating new snippet as a Designer
81
- Given I have a "designer" API token
82
- When I do an API GET request to snippets.json
83
- Then the JSON response should be an array
84
- And the JSON response should have 1 entry
85
- When I do an API POST to snippets.json with:
86
- """
87
- {
88
- "snippet": {
89
- "name": "Another snippet",
90
- "template": "<h1>Another Snippet!</h1>"
91
- }
92
- }
93
- """
94
- When I do an API GET request to snippets.json
95
- Then the JSON response should be an array
96
- And the JSON response should have 2 entries
97
- And the JSON should have the following:
98
- | 0/name | "Another snippet" |
99
- | 0/template | "<h1>Another Snippet!</h1>" |
100
-
101
- Scenario: Creating new snippet as an Author
102
- Given I have an "author" API token
103
- When I do an API POST to snippets.json with:
104
- """
105
- {
106
- "snippet": {
107
- "name": "Another snippet",
108
- "template": "<h1>Another Snippet!</h1>"
109
- }
110
- }
111
- """
112
- Then an access denied error should occur
113
-
114
- # update snippet
115
-
116
- Scenario: Updating snippet as an Admin
117
- Given I have an "admin" API token
118
- When I do an API PUT to snippets/4f832c2cb0d86d3f42fffffe.json with:
119
- """
120
- {
121
- "snippet": {
122
- "name": "Brand new updated name"
123
- }
124
- }
125
- """
126
- When I do an API GET request to snippets/4f832c2cb0d86d3f42fffffe.json
127
- Then the JSON response at "name" should be "Brand new updated name"
128
-
129
- Scenario: Updating snippet as a Designer
130
- Given I have a "designer" API token
131
- When I do an API PUT to snippets/4f832c2cb0d86d3f42fffffe.json with:
132
- """
133
- {
134
- "snippet": {
135
- "name": "Brand new updated name"
136
- }
137
- }
138
- """
139
- When I do an API GET request to snippets/4f832c2cb0d86d3f42fffffe.json
140
- Then the JSON response at "name" should be "Brand new updated name"
141
-
142
- Scenario: Updating snippet as an Author
143
- Given I have a "author" API token
144
- When I do an API PUT to snippets/4f832c2cb0d86d3f42fffffe.json with:
145
- """
146
- {
147
- "snippet": {
148
- "name": "Brand new updated name"
149
- }
150
- }
151
- """
152
- Then an access denied error should occur
153
-
154
- # destroy snippet
155
-
156
- Scenario: Destroying snippet as an Admin
157
- Given I have an "admin" API token
158
- When I do an API GET request to snippets.json
159
- Then the JSON response should be an array
160
- And the JSON response should have 1 entry
161
- When I do an API DELETE to snippets/4f832c2cb0d86d3f42fffffe.json
162
- When I do an API GET request to snippets.json
163
- Then the JSON response should be an array
164
- And the JSON response should have 0 entries
165
-
166
- Scenario: Destroying snippet as a Designer
167
- Given I have a "designer" API token
168
- When I do an API GET request to snippets.json
169
- Then the JSON response should be an array
170
- And the JSON response should have 1 entry
171
- When I do an API DELETE to snippets/4f832c2cb0d86d3f42fffffe.json
172
- When I do an API GET request to snippets.json
173
- Then the JSON response should be an array
174
- And the JSON response should have 0 entries
175
-
176
- Scenario: Deleting snippet as an Author
177
- Given I have a "author" API token
178
- When I do an API DELETE to snippets/4f832c2cb0d86d3f42fffffe.json
179
- Then an access denied error should occur
@@ -1,185 +0,0 @@
1
- Feature: Theme Assets
2
- In order to ensure theme assets are not tampered with
3
- As an admin, designer or author
4
- I will be restricted based on my role
5
-
6
- Background:
7
- Given I have the site: "test site" set up
8
- And a javascript asset named "my_javascript.js" with id "4f832c2cb0d86d3f42fffffe"
9
- And a stylesheet asset named "my_stylesheet.css" with id "4f832c2cb0d86d3f42ffffff"
10
-
11
- Scenario: As an unauthenticated user
12
- Given I am not authenticated
13
- When I do an API GET to theme_assets.json
14
- Then the JSON response at "error" should be "You need to sign in or sign up before continuing."
15
-
16
- # listing theme assets
17
-
18
- Scenario: Accessing theme assets as an Admin
19
- Given I have an "admin" API token
20
- When I do an API GET request to theme_assets.json
21
- Then the JSON response should be an array
22
- And the JSON response should have 2 entries
23
-
24
- Scenario: Accessing theme assets as a Designer
25
- Given I have a "designer" API token
26
- When I do an API GET request to theme_assets.json
27
- Then the JSON response should be an array
28
- And the JSON response should have 2 entries
29
-
30
- Scenario: Accessing theme assets as an Author
31
- Given I have an "author" API token
32
- When I do an API GET request to theme_assets.json
33
- Then the JSON response should be an array
34
- And the JSON response should have 2 entries
35
-
36
- # showing theme asset
37
-
38
- Scenario: Accessing theme asset as an Admin
39
- Given I have an "admin" API token
40
- When I do an API GET request to theme_assets/4f832c2cb0d86d3f42fffffe.json
41
- Then the JSON response at "local_path" should be "my_javascript.js"
42
-
43
- Scenario: Accessing theme asset as a Designer
44
- Given I have a "designer" API token
45
- When I do an API GET request to theme_assets/4f832c2cb0d86d3f42fffffe.json
46
- Then the JSON response at "local_path" should be "my_javascript.js"
47
-
48
- Scenario: Accessing theme asset as an Author
49
- Given I have an "author" API token
50
- When I do an API GET request to theme_assets/4f832c2cb0d86d3f42fffffe.json
51
- Then the JSON response at "local_path" should be "my_javascript.js"
52
-
53
- # create theme asset
54
-
55
- Scenario: Creating new theme asset as an Admin
56
- Given I have an "admin" API token
57
- When I do an API GET request to theme_assets.json
58
- Then the JSON response should be an array
59
- And the JSON response should have 2 entries
60
- When I do an API POST to theme_assets.json with:
61
- """
62
- {
63
- "theme_asset": {
64
- "plain_text_name": "new-javascript.js",
65
- "plain_text": "function doNothing() {}",
66
- "plain_text_type": "javascript",
67
- "performing_plain_text": "true"
68
- }
69
- }
70
- """
71
- When I do an API GET request to theme_assets.json
72
- Then the JSON response should be an array
73
- And the JSON response should have 3 entries
74
- And the JSON should have the following:
75
- | 1/local_path | "new-javascript.js" |
76
- | 1/content_type | "javascript" |
77
-
78
- Scenario: Creating new theme asset as a Designer
79
- Given I have a "designer" API token
80
- When I do an API GET request to theme_assets.json
81
- Then the JSON response should be an array
82
- And the JSON response should have 2 entries
83
- When I do an API POST to theme_assets.json with:
84
- """
85
- {
86
- "theme_asset": {
87
- "plain_text_name": "new-javascript.js",
88
- "plain_text": "function doNothing() {}",
89
- "plain_text_type": "javascript",
90
- "performing_plain_text": "true"
91
- }
92
- }
93
- """
94
- When I do an API GET request to theme_assets.json
95
- Then the JSON response should be an array
96
- And the JSON response should have 3 entries
97
- And the JSON should have the following:
98
- | 1/local_path | "new-javascript.js" |
99
- | 1/content_type | "javascript" |
100
-
101
- Scenario: Creating new theme asset as an Author
102
- Given I have an "author" API token
103
- When I do an API POST to theme_assets.json with:
104
- """
105
- {
106
- "theme_asset": {
107
- "plain_text_name": "new-javascript.js",
108
- "plain_text": "function doNothing() {}",
109
- "plain_text_type": "javascript",
110
- "performing_plain_text": "true"
111
- }
112
- }
113
- """
114
- Then an access denied error should occur
115
-
116
- # update theme asset
117
-
118
- Scenario: Updating theme asset as an Admin
119
- Given I have an "admin" API token
120
- When I do an API PUT to theme_assets/4f832c2cb0d86d3f42fffffe.json with:
121
- """
122
- {
123
- "theme_asset": {
124
- "folder": "changed"
125
- }
126
- }
127
- """
128
- When I do an API GET request to theme_assets/4f832c2cb0d86d3f42fffffe.json
129
- Then the JSON response should have the following:
130
- | local_path | "changed/my_javascript.js" |
131
-
132
- Scenario: Updating theme asset as a Designer
133
- Given I have a "designer" API token
134
- When I do an API PUT to theme_assets/4f832c2cb0d86d3f42fffffe.json with:
135
- """
136
- {
137
- "theme_asset": {
138
- "folder": "changed"
139
- }
140
- }
141
- """
142
- When I do an API GET request to theme_assets/4f832c2cb0d86d3f42fffffe.json
143
- Then the JSON response should have the following:
144
- | local_path | "changed/my_javascript.js" |
145
-
146
- Scenario: Updating theme asset as an Author
147
- Given I have a "author" API token
148
- When I do an API PUT to theme_assets/4f832c2cb0d86d3f42fffffe.json with:
149
- """
150
- {
151
- "theme_asset": {
152
- "folder": "changed"
153
- }
154
- }
155
- """
156
- When I do an API GET request to theme_assets/4f832c2cb0d86d3f42fffffe.json
157
- Then the JSON response should have the following:
158
- | local_path | "changed/my_javascript.js" |
159
-
160
- # destroy theme asset
161
-
162
- Scenario: Destroying theme asset as an Admin
163
- Given I have an "admin" API token
164
- When I do an API GET request to theme_assets.json
165
- Then the JSON response should be an array
166
- And the JSON response should have 2 entries
167
- When I do an API DELETE to theme_assets/4f832c2cb0d86d3f42fffffe.json
168
- When I do an API GET request to theme_assets.json
169
- Then the JSON response should be an array
170
- And the JSON response should have 1 entries
171
-
172
- Scenario: Destroying theme asset as a Designer
173
- Given I have a "designer" API token
174
- When I do an API GET request to theme_assets.json
175
- Then the JSON response should be an array
176
- And the JSON response should have 2 entries
177
- When I do an API DELETE to theme_assets/4f832c2cb0d86d3f42fffffe.json
178
- When I do an API GET request to theme_assets.json
179
- Then the JSON response should be an array
180
- And the JSON response should have 1 entries
181
-
182
- Scenario: Deleting theme asset as an Author
183
- Given I have a "author" API token
184
- When I do an API DELETE to theme_assets/4f832c2cb0d86d3f42fffffe.json
185
- Then an access denied error should occur
@@ -1,253 +0,0 @@
1
- Feature: Translations
2
- In order to ensure translations are not tampered with
3
- As an admin, designer or author
4
- I will be restricted based on my role
5
-
6
- Background:
7
- Given I have the site: "test site" set up with id: "4f832c2cb0d86d3f42fffffb"
8
- And the site "Locomotive test website" has locales "en, es, fr"
9
- And a translation with key "the_cake_is_a_lie" and id "4f832c2cb0d86d3f42fffffe" with values:
10
- | en | The cake is a lie |
11
- | es | La tarta es mentira |
12
-
13
- Scenario: As an unauthenticated user
14
- Given I am not authenticated
15
- When I do an API GET to translations.json
16
- Then the JSON response at "error" should be "You need to sign in or sign up before continuing."
17
-
18
- Scenario: Accessing translations as an Admin
19
- Given I have an "admin" API token
20
- When I do an API GET request to translations.json
21
- Then the JSON response should be an array
22
- And the JSON response should have 1 entry
23
-
24
- Scenario: Accessing translations as a Designer
25
- Given I have a "designer" API token
26
- When I do an API GET request to translations.json
27
- Then the JSON response should be an array
28
- And the JSON response should have 1 entry
29
-
30
- Scenario: Accessing translations as an Author
31
- Given I have an "author" API token
32
- When I do an API GET request to translations.json
33
- Then the JSON response should be an array
34
- And the JSON response should have 1 entry
35
-
36
- Scenario: Accessing translations as an Admin
37
- Given I have an "admin" API token
38
- When I do an API GET request to translations/4f832c2cb0d86d3f42fffffe.json
39
- Then the JSON response at "values" should be:
40
- """
41
- {
42
- "en": "The cake is a lie",
43
- "es": "La tarta es mentira"
44
- }
45
- """
46
-
47
- Scenario: Accessing translation as a Designer
48
- Given I have a "designer" API token
49
- When I do an API GET request to translations/4f832c2cb0d86d3f42fffffe.json
50
- Then the JSON response at "values" should be:
51
- """
52
- {
53
- "en": "The cake is a lie",
54
- "es": "La tarta es mentira"
55
- }
56
- """
57
-
58
- Scenario: Accessing translation as an Author
59
- Given I have an "author" API token
60
- When I do an API GET request to translations/4f832c2cb0d86d3f42fffffe.json
61
- Then the JSON response at "values" should be:
62
- """
63
- {
64
- "en": "The cake is a lie",
65
- "es": "La tarta es mentira"
66
- }
67
- """
68
-
69
- Scenario: Creating new translation as an Admin
70
- Given I have an "admin" API token
71
- When I do an API POST to translations.json with:
72
- """
73
- {
74
- "translation": {
75
- "key": "hello_world",
76
- "values": {
77
- "en": "Hello, World",
78
- "es": "Hola, Mundo",
79
- "fr": "Bonjour, le Monde"
80
- }
81
- }
82
- }
83
- """
84
- And I do an API GET request to translations.json
85
- Then the JSON response should be an array
86
- And the JSON response should have 2 entries
87
- And the JSON response at "1" should be:
88
- """
89
- {
90
- "key": "hello_world",
91
- "values": {
92
- "en": "Hello, World",
93
- "es": "Hola, Mundo",
94
- "fr": "Bonjour, le Monde"
95
- }
96
- }
97
- """
98
-
99
- Scenario: Creating new translation as a Designer
100
- Given I have a "designer" API token
101
- When I do an API POST to translations.json with:
102
- """
103
- {
104
- "translation": {
105
- "key": "hello_world",
106
- "values": {
107
- "en": "Hello, World",
108
- "es": "Hola, Mundo",
109
- "fr": "Bonjour, le Monde"
110
- }
111
- }
112
- }
113
- """
114
- And I do an API GET request to translations.json
115
- Then the JSON response should be an array
116
- And the JSON response should have 2 entries
117
- And the JSON response at "1" should be:
118
- """
119
- {
120
- "key": "hello_world",
121
- "values": {
122
- "en": "Hello, World",
123
- "es": "Hola, Mundo",
124
- "fr": "Bonjour, le Monde"
125
- }
126
- }
127
- """
128
-
129
- Scenario: Creating new translation as an Author
130
- Given I have an "author" API token
131
- When I do an API POST to translations.json with:
132
- """
133
- {
134
- "translation": {
135
- "key": "hello_world",
136
- "values": {
137
- "en": "Hello, World",
138
- "es": "Hola, Mundo",
139
- "fr": "Bonjour, le Monde"
140
- }
141
- }
142
- }
143
- """
144
- And I do an API GET request to translations.json
145
- Then the JSON response should be an array
146
- And the JSON response should have 2 entries
147
- And the JSON response at "1" should be:
148
- """
149
- {
150
- "key": "hello_world",
151
- "values": {
152
- "en": "Hello, World",
153
- "es": "Hola, Mundo",
154
- "fr": "Bonjour, le Monde"
155
- }
156
- }
157
- """
158
- # update translation
159
-
160
- Scenario: Updating translation as an Admin
161
- Given I have an "admin" API token
162
- When I do an API PUT to translations/4f832c2cb0d86d3f42fffffe.json with:
163
- """
164
- {
165
- "translation": {
166
- "key": "the_cake_is_true",
167
- "values": {
168
- "en": "The cake is true"
169
- }
170
- }
171
- }
172
- """
173
- When I do an API GET request to translations/4f832c2cb0d86d3f42fffffe.json
174
- Then the JSON response should be:
175
- """
176
- {
177
- "key": "the_cake_is_true",
178
- "values": {
179
- "en": "The cake is true"
180
- }
181
- }
182
- """
183
-
184
- Scenario: Updating translation as a Designer
185
- Given I have a "designer" API token
186
- When I do an API PUT to translations/4f832c2cb0d86d3f42fffffe.json with:
187
- """
188
- {
189
- "translation": {
190
- "key": "the_cake_is_true",
191
- "values": {
192
- "en": "The cake is true"
193
- }
194
- }
195
- }
196
- """
197
- When I do an API GET request to translations/4f832c2cb0d86d3f42fffffe.json
198
- Then the JSON response should be:
199
- """
200
- {
201
- "key": "the_cake_is_true",
202
- "values": {
203
- "en": "The cake is true"
204
- }
205
- }
206
- """
207
-
208
- Scenario: Updating translation as an Author
209
- Given I have a "author" API token
210
- When I do an API PUT to translations/4f832c2cb0d86d3f42fffffe.json with:
211
- """
212
- {
213
- "translation": {
214
- "key": "the_cake_is_true",
215
- "values": {
216
- "en": "The cake is true"
217
- }
218
- }
219
- }
220
- """
221
- When I do an API GET request to translations/4f832c2cb0d86d3f42fffffe.json
222
- Then the JSON response should be:
223
- """
224
- {
225
- "key": "the_cake_is_true",
226
- "values": {
227
- "en": "The cake is true"
228
- }
229
- }
230
- """
231
-
232
- # destroy translation
233
-
234
- Scenario: Destroying translation as an Admin
235
- Given I have an "admin" API token
236
- When I do an API DELETE to translations/4f832c2cb0d86d3f42fffffe.json
237
- When I do an API GET request to translations.json
238
- Then the JSON response should be an array
239
- And the JSON response should have 0 entries
240
-
241
- Scenario: Destroying translation as a Designer
242
- Given I have a "designer" API token
243
- When I do an API DELETE to translations/4f832c2cb0d86d3f42fffffe.json
244
- When I do an API GET request to translations.json
245
- Then the JSON response should be an array
246
- And the JSON response should have 0 entries
247
-
248
- Scenario: Deleting translation as an Author
249
- Given I have a "author" API token
250
- When I do an API DELETE to translations/4f832c2cb0d86d3f42fffffe.json
251
- When I do an API GET request to translations.json
252
- Then the JSON response should be an array
253
- And the JSON response should have 0 entries