katapult 0.2.0 → 0.3.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.
Files changed (143) hide show
  1. checksums.yaml +5 -5
  2. data/.rspec +1 -0
  3. data/.ruby-version +1 -1
  4. data/Gemfile +9 -0
  5. data/README.md +122 -94
  6. data/Rakefile +13 -0
  7. data/bin/katapult +59 -25
  8. data/features/application_model.feature +55 -0
  9. data/features/authenticate.feature +88 -62
  10. data/features/basics.feature +64 -402
  11. data/features/binary.feature +56 -42
  12. data/features/configuration.feature +4 -4
  13. data/features/model.feature +21 -30
  14. data/features/navigation.feature +35 -48
  15. data/features/step_definitions/aruba_steps.rb +3 -0
  16. data/features/step_definitions/katapult_steps.rb +307 -8
  17. data/features/step_definitions/rails_steps.rb +74 -14
  18. data/features/step_definitions/test_steps.rb +5 -5
  19. data/features/step_definitions/version_steps.rb +22 -0
  20. data/features/support/env.rb +11 -3
  21. data/features/{wui.feature → web_ui.feature} +175 -148
  22. data/katapult.gemspec +8 -13
  23. data/lib/generators/katapult/app_model/app_model_generator.rb +12 -0
  24. data/lib/generators/katapult/app_model/templates/lib/katapult/application_model.rb +40 -0
  25. data/lib/generators/katapult/basics/basics_generator.rb +186 -51
  26. data/lib/generators/katapult/basics/templates/.browserslistrc +1 -0
  27. data/lib/generators/katapult/basics/templates/.gitignore +20 -21
  28. data/lib/generators/katapult/basics/templates/.rspec_parallel +3 -0
  29. data/lib/generators/katapult/basics/templates/Capfile +5 -1
  30. data/lib/generators/katapult/basics/templates/Gemfile +23 -34
  31. data/lib/generators/katapult/basics/templates/Guardfile +0 -12
  32. data/lib/generators/katapult/basics/templates/app/controllers/errors_controller.rb +9 -0
  33. data/lib/generators/katapult/basics/templates/app/helpers/unpoly_helper.rb +13 -0
  34. data/lib/generators/katapult/{haml → basics}/templates/app/views/layouts/_flashes.html.haml +1 -1
  35. data/lib/generators/katapult/basics/templates/app/views/layouts/_menu_bar.html.haml.tt +12 -0
  36. data/lib/generators/katapult/basics/templates/app/views/layouts/application.html.haml.tt +25 -0
  37. data/lib/generators/katapult/basics/templates/app/webpack/assets/images/.keep +0 -0
  38. data/lib/generators/katapult/basics/templates/app/webpack/assets/index.js +16 -0
  39. data/lib/generators/katapult/basics/templates/app/webpack/assets/javascripts/application.js +0 -0
  40. data/lib/generators/katapult/basics/templates/app/webpack/assets/javascripts/bootstrap.js +12 -0
  41. data/lib/generators/katapult/basics/templates/app/webpack/assets/javascripts/compilers/.keep +0 -0
  42. data/lib/generators/katapult/basics/templates/app/webpack/assets/javascripts/macros/content_link.js +17 -0
  43. data/lib/generators/katapult/basics/templates/app/webpack/assets/javascripts/macros/modal_link.js +17 -0
  44. data/lib/generators/katapult/basics/templates/app/webpack/assets/javascripts/unpoly.js +9 -0
  45. data/lib/generators/katapult/basics/templates/app/webpack/assets/stylesheets/_definitions.sass +25 -0
  46. data/lib/generators/katapult/basics/templates/app/webpack/assets/stylesheets/_environment.sass +2 -0
  47. data/lib/generators/katapult/basics/templates/app/webpack/assets/stylesheets/_mixins.sass +3 -0
  48. data/lib/generators/katapult/basics/templates/app/webpack/assets/stylesheets/blocks/.keep +0 -0
  49. data/lib/generators/katapult/basics/templates/app/webpack/assets/stylesheets/custom_bootstrap.sass +50 -0
  50. data/lib/generators/katapult/basics/templates/app/webpack/assets/stylesheets/ext/.keep +0 -0
  51. data/lib/generators/katapult/basics/templates/app/webpack/assets/stylesheets/ext/bootstrap/navbar.sass +83 -0
  52. data/lib/generators/katapult/basics/templates/app/webpack/assets/stylesheets/theme.sass +11 -0
  53. data/lib/generators/katapult/basics/templates/app/webpack/assets/stylesheets/unpoly.sass +2 -0
  54. data/lib/generators/katapult/basics/templates/app/webpack/packs/application.js +13 -0
  55. data/lib/generators/katapult/basics/templates/config/database.sample.yml +1 -1
  56. data/lib/generators/katapult/basics/templates/config/deploy.rb +3 -4
  57. data/lib/generators/katapult/basics/templates/config/environments/staging.rb +5 -0
  58. data/lib/generators/katapult/basics/templates/config/initializers/better_errors.rb +23 -0
  59. data/lib/generators/katapult/basics/templates/config/initializers/exception_notification.rb.tt +1 -1
  60. data/lib/generators/katapult/basics/templates/config/initializers/ext.rb +1 -1
  61. data/lib/generators/katapult/basics/templates/config/webpack/loaders/unpoly.js +4 -0
  62. data/lib/generators/katapult/basics/templates/features/support/capybara_screenshot.rb +7 -0
  63. data/lib/generators/katapult/basics/templates/features/support/factory_bot.rb +1 -0
  64. data/lib/generators/katapult/basics/templates/features/support/paths.rb +7 -2
  65. data/lib/generators/katapult/basics/templates/features/support/rspec_doubles.rb +1 -0
  66. data/lib/generators/katapult/basics/templates/features/support/selectors.rb +3 -3
  67. data/lib/generators/katapult/basics/templates/features/support/selenium.rb +13 -0
  68. data/lib/generators/katapult/basics/templates/features/support/{env-custom.rb → spreewald.rb} +0 -0
  69. data/lib/generators/katapult/basics/templates/features/support/webpacker.rb +35 -0
  70. data/lib/generators/katapult/basics/templates/lib/ext/action_view/form_for_with_development_errors.rb +31 -31
  71. data/lib/generators/katapult/basics/templates/lib/ext/active_record/find_by_anything.rb +4 -3
  72. data/lib/generators/katapult/basics/templates/public/robots.txt +5 -0
  73. data/lib/generators/katapult/basics/templates/spec/assets/sample.pdf +0 -0
  74. data/lib/generators/katapult/basics/templates/spec/factories/factories.rb +1 -1
  75. data/lib/generators/katapult/basics/templates/spec/support/database_cleaner.rb +20 -0
  76. data/lib/generators/katapult/basics/templates/spec/support/factory_bot.rb +3 -0
  77. data/lib/generators/katapult/basics/templates/spec/support/fixture_file.rb +6 -0
  78. data/lib/generators/katapult/basics/templates/spec/support/postgresql_sequences.rb +15 -0
  79. data/lib/generators/katapult/basics/templates/spec/support/timecop.rb +3 -0
  80. data/lib/generators/katapult/clearance/clearance_generator.rb +14 -2
  81. data/lib/generators/katapult/clearance/templates/app/views/layouts/_current_user.html.haml +11 -0
  82. data/lib/generators/katapult/clearance/templates/app/views/passwords/create.html.haml +10 -4
  83. data/lib/generators/katapult/clearance/templates/app/views/passwords/edit.html.haml +12 -12
  84. data/lib/generators/katapult/clearance/templates/app/views/passwords/new.html.haml +14 -11
  85. data/lib/generators/katapult/clearance/templates/app/views/sessions/new.html.haml +16 -15
  86. data/lib/generators/katapult/clearance/templates/features/authentication.feature +3 -3
  87. data/lib/generators/katapult/cucumber_features/templates/feature.feature +1 -1
  88. data/lib/generators/katapult/model_specs/templates/model_spec.rb +3 -5
  89. data/lib/generators/katapult/navigation/navigation_generator.rb +7 -1
  90. data/lib/generators/katapult/navigation/templates/app/views/layouts/_navigation.html.haml +15 -0
  91. data/lib/generators/katapult/transform/transform_generator.rb +12 -17
  92. data/lib/generators/katapult/views/templates/_form.html.haml +48 -0
  93. data/lib/generators/katapult/views/templates/app/helpers/table_helper.rb +14 -0
  94. data/lib/generators/katapult/views/templates/app/webpack/assets/stylesheets/blocks/action_bar.sass +22 -0
  95. data/lib/generators/katapult/views/templates/app/webpack/assets/stylesheets/blocks/title.sass +11 -0
  96. data/lib/generators/katapult/views/templates/custom_action.html.haml +5 -0
  97. data/lib/generators/katapult/views/templates/edit.html.haml +4 -0
  98. data/lib/generators/katapult/views/templates/index.html.haml +26 -0
  99. data/lib/generators/katapult/{haml → views}/templates/new.html.haml +1 -1
  100. data/lib/generators/katapult/views/templates/show.html.haml +39 -0
  101. data/lib/generators/katapult/{haml/haml_generator.rb → views/views_generator.rb} +19 -25
  102. data/lib/generators/katapult/{w_u_i → web_ui}/templates/_route.rb +3 -3
  103. data/lib/generators/katapult/{w_u_i → web_ui}/templates/controller.rb +21 -23
  104. data/lib/generators/katapult/{w_u_i/w_u_i_generator.rb → web_ui/web_ui_generator.rb} +7 -12
  105. data/lib/katapult/action.rb +1 -1
  106. data/lib/katapult/application_model.rb +8 -8
  107. data/lib/katapult/binary_util.rb +48 -10
  108. data/lib/katapult/generator.rb +2 -10
  109. data/lib/katapult/generator_goodies.rb +23 -0
  110. data/lib/katapult/navigation.rb +10 -5
  111. data/lib/katapult/parser.rb +15 -8
  112. data/lib/katapult/version.rb +5 -1
  113. data/lib/katapult/{wui.rb → web_ui.rb} +19 -4
  114. data/lib/katapult.rb +0 -5
  115. data/script/console +5 -2
  116. data/script/kta +8 -0
  117. data/script/update +80 -0
  118. data/spec/action_spec.rb +0 -1
  119. data/spec/attribute_spec.rb +0 -1
  120. data/spec/element_spec.rb +0 -1
  121. data/spec/model_spec.rb +0 -1
  122. data/spec/parser_spec.rb +26 -0
  123. data/spec/util_spec.rb +0 -1
  124. data/spec/{wui_spec.rb → web_ui_spec.rb} +24 -12
  125. metadata +86 -124
  126. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/_all.sass +0 -4
  127. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/_items.sass +0 -11
  128. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/_layout.sass +0 -26
  129. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/_navigation.sass +0 -11
  130. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/_tools.sass +0 -12
  131. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application.sass +0 -6
  132. data/lib/generators/katapult/basics/templates/config/spring.rb +0 -3
  133. data/lib/generators/katapult/basics/templates/features/support/factory_girl.rb +0 -1
  134. data/lib/generators/katapult/basics/templates/spec/support/factory_girl.rb +0 -3
  135. data/lib/generators/katapult/haml/templates/_form.html.haml +0 -38
  136. data/lib/generators/katapult/haml/templates/app/views/layouts/application.html.haml +0 -33
  137. data/lib/generators/katapult/haml/templates/custom_action.html.haml +0 -5
  138. data/lib/generators/katapult/haml/templates/edit.html.haml +0 -4
  139. data/lib/generators/katapult/haml/templates/index.html.haml +0 -29
  140. data/lib/generators/katapult/haml/templates/show.html.haml +0 -39
  141. data/lib/generators/katapult/install/install_generator.rb +0 -14
  142. data/lib/generators/katapult/install/templates/lib/katapult/application_model.rb +0 -20
  143. data/lib/generators/katapult/navigation/templates/app/models/navigation.rb +0 -12
@@ -1,203 +1,33 @@
1
- Feature: Katapult in general
2
-
3
- Background:
4
- Given a pristine Rails application
5
-
6
-
7
- Scenario: Install katapult
8
- When I install katapult
9
- Then the file "lib/katapult/application_model.rb" should contain exactly:
10
- """
11
- # Here you define the fundamentals of your application.
12
- #
13
- # Add a model:
14
- # model 'user' do |user|
15
- # user.attr :name
16
- # user.attr :birth, type: :datetime
17
- # user.attr :email
18
- # end
19
- #
20
- # Add a web user interface:
21
- # wui 'user' do |wui|
22
- # wui.crud # Creates all CRUD actions: index, new, show, etc.
23
- # wui.action :lock, scope: :member, method: :post
24
- # end
25
- #
26
- # Add navigation
27
- # navigation :main
28
- #
29
- # Add authentication
30
- # authenticate 'user', system_email: 'system@example.com'
31
-
32
- """
33
-
1
+ #@announce-output
2
+ #@announce-stderr
3
+ Feature: Preparation of a new Rails app (basics generator)
34
4
 
35
5
  Scenario: Generate basic files and settings
36
- Given I install katapult
6
+ Given a pristine Rails application
7
+ And I install katapult
37
8
 
38
9
  When I generate katapult basics
39
- Then the file ".ruby-version" should contain "2.3.0"
40
-
10
+ Then the ruby-version file should be up-to-date
41
11
 
42
- And the file "config/cucumber.yml" should contain:
43
- """
44
- default: <%= std_opts %> features
45
- wip: --tags @wip:3 --wip features
46
- parallel: <%= std_opts %> features <%= log_failures %>
47
- rerun: -r features --format pretty --strict <%= rerun_failures %> <%= log_failures %>
48
- """
49
-
50
-
51
- And the file ".gitignore" should contain "config/database.yml"
52
- And the file ".bundle/config" should match /NOKOGIRI.*--use-system-libraries/
53
- And the file "Guardfile" should contain:
12
+ And the file ".gitignore" should contain "config/database.yml"
13
+ And the file ".bundle/config" should match /NOKOGIRI.*--use-system-libraries/
14
+ And the file "Guardfile" should contain:
54
15
  """
55
16
  guard 'livereload' do
56
17
  watch %r{app/views/.+\.(erb|haml)$}
57
- watch 'app/models/navigation.rb' # Navy
58
18
  watch 'app/models/power.rb' # Consul
59
19
  watch %r{app/helpers/.+\.rb}
60
- watch %r{public/.+\.(css|js|html)}
61
20
  watch %r{config/locales/.+\.yml}
62
21
  watch %r{spec/javascripts/} # Jasmine
63
-
64
- # Rails Assets Pipeline
65
- watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|sass|js|coffee|html|png|jpg))).*}) do |m|
66
- filename = m[3]
67
- # When a .sass (or .css.sass) file was changed, tell the client to load the .css version.
68
- # Similarly, for .coffee / .js.coffee files we ask the client to reload the .js file.
69
- filename.gsub! /(\.css)?\.sass$/, '.css'
70
- filename.gsub! /(\.js)?\.coffee$/, '.js'
71
- "/assets/#{filename}"
72
- end
73
22
  end
74
23
  """
75
- And the file "Capfile" should contain:
76
- """
77
- # Load DSL and set up stages
78
- require 'capistrano/setup'
79
-
80
- # Include default deployment tasks
81
- require 'capistrano/deploy'
82
-
83
- # Include tasks from other gems included in your Gemfile
84
- require 'capistrano/bundler'
85
- require 'capistrano/maintenance'
86
- require 'capistrano/rails/assets'
87
- require 'capistrano/rails/migrations'
88
- require 'whenever/capistrano'
89
-
90
- Dir.glob('lib/capistrano/tasks/*.rake').each do |r|
91
- # `import r` calls Rake.application.add_import(r), which imports the file only
92
- # *after* this file has been processed, so the imported tasks would not be
93
- # available to the hooks below.
94
- Rake.load_rakefile r
95
- end
96
24
 
97
- before 'deploy:updating', 'db:dump'
98
- after 'deploy:published', 'deploy:restart'
99
- after 'deploy:published', 'db:warn_if_pending_migrations'
100
- after 'deploy:published', 'db:show_dump_usage'
101
- after 'deploy:finished', 'deploy:cleanup' # https://makandracards.com/makandra/1432
102
- """
103
- And the file "Gemfile" should contain "gem 'rails', '4.2.6'"
104
- And the file "Gemfile" should contain exactly:
105
- """
106
- source 'https://rubygems.org'
107
-
108
- gem 'rails', '4.2.6'
109
- gem 'pg', '~> 0.15'
110
- gem 'jquery-rails'
111
- gem 'jbuilder', '~> 2.0'
112
- gem 'katapult', path: '../../..'
113
-
114
- # internal
115
- gem 'exception_notification'
116
- # gem 'admin_cleaner', git: 'git@code.makandra.de:makandra/admin_cleaner.git'
117
-
118
- # security
119
- gem 'breach-mitigation-rails'
120
- gem 'safe_cookies'
121
-
122
- # better coding
123
- gem 'modularity'
124
- gem 'edge_rider'
125
- gem 'andand'
126
-
127
- # models
128
- gem 'has_defaults'
129
- gem 'assignable_values'
130
-
131
- # gem 'carrierwave'
132
- # gem 'mini_magick'
133
-
134
- # gem 'spreadsheet'
135
- # gem 'vcard'
136
-
137
- # views
138
- # gem 'simple_form'
139
- # gem 'nested_form'
140
- gem 'will_paginate'
141
- gem 'makandra-navy', require: 'navy'
142
-
143
- # assets
144
- gem 'haml-rails'
145
- gem 'bootstrap-sass'
146
- gem 'sass-rails'
147
- gem 'autoprefixer-rails'
148
- gem 'coffee-rails'
149
- gem 'therubyracer', platform: :ruby
150
- gem 'uglifier'
151
- gem 'compass-rails'
152
- gem 'compass-rgbapng'
153
-
154
- group :development do
155
- gem 'query_diet'
156
- gem 'better_errors'
157
- gem 'binding_of_caller'
158
- gem 'thin'
159
-
160
- gem 'parallel_tests'
161
- gem 'guard-livereload', require: false
162
- gem 'rack-livereload'
163
- gem 'spring-commands-rspec'
164
- gem 'spring-commands-cucumber'
165
- end
166
-
167
- group :development, :test do
168
- gem 'byebug'
169
- gem 'factory_girl_rails'
170
- gem 'rspec-rails'
171
- gem 'spring'
172
- end
173
-
174
- group :test do
175
- gem 'database_cleaner'
176
- gem 'timecop'
177
- gem 'launchy'
178
-
179
- gem 'capybara'
180
- gem 'capybara-screenshot'
181
- gem 'cucumber', '< 2' # Incompatible with Cucumber Factory
182
- gem 'cucumber-rails', require: false
183
- gem 'cucumber_factory'
184
- gem 'selenium-webdriver'
185
- gem 'spreewald'
186
-
187
- gem 'rspec'
188
- gem 'shoulda-matchers', require: false
189
- end
190
-
191
- group :deploy do
192
- gem 'capistrano-rails', require: false
193
- gem 'capistrano-bundler', require: false
194
- gem 'capistrano-maintenance'
195
- end
196
- """
25
+ And the configured Rails version should be listed in the Gemfile.lock
26
+ And the file "Gemfile" should contain "gem 'katapult', path: '../../..'"
197
27
 
198
28
  And the file "app/controllers/application_controller.rb" should contain:
199
29
  """
200
- before_filter :make_action_mailer_use_request_host_and_protocol
30
+ before_action :make_action_mailer_use_request_host_and_protocol
201
31
 
202
32
  private
203
33
 
@@ -206,25 +36,47 @@ Feature: Katapult in general
206
36
  ActionMailer::Base.default_url_options[:host] = request.host_with_port
207
37
  end
208
38
  """
39
+ And the file "app/mailers/application_mailer.rb" should contain "default from: Rails.configuration.system_email"
209
40
 
210
- # Just checking turbolinks was properly removed
211
- And the file "app/views/layouts/application.html.erb" should not contain "turbolinks"
212
- But the file "app/views/layouts/application.html.erb" should contain:
213
- """
214
- <%= stylesheet_link_tag 'application', media: 'all' %>
215
- <%= javascript_include_tag 'application' %>
41
+ And a file named "public/robots.txt" should exist
42
+ And Turbolinks should be removed
43
+ And the Asset Pipeline should be removed
44
+
45
+ But Webpacker should be employed
46
+ And styles should be prepared
47
+ And Unpoly should be installed
48
+ And the file ".browserslistrc" should contain "> 1%"
49
+
50
+ And the application layout should be set up
51
+ And the errors controller should be installed
52
+
53
+ # Spring
54
+ And the file "config/spring.rb" should contain:
216
55
  """
56
+ # Custom generator templates are put into lib/templates
57
+ FileUtils.mkdir_p 'lib/templates'
217
58
 
59
+ %w(
60
+ lib/templates
61
+ """
62
+ And binstubs should be set up
218
63
 
219
64
 
220
- # Config
65
+ # Config
221
66
  And the file "config/application.rb" should contain "config.time_zone = 'Berlin'"
67
+ And the file "config/application.rb" should contain "config.system_email = 'system@katapult_test_app.com'"
222
68
  And the file "config/environments/development.rb" should contain "config.assets.debug = false"
69
+ And the file "config/environments/development.rb" should contain "config.assets.digest = false # For Guard::Livereload"
223
70
  And the file "config/environments/development.rb" should contain:
224
71
  """
225
72
  config.middleware.use Rack::LiveReload
226
73
  """
227
- And a file named "config/environments/staging.rb" should exist
74
+ And the file "config/environments/development.rb" should contain:
75
+ """
76
+ config.active_record.migration_error = false
77
+ """
78
+ And the file "config/environments/staging.rb" should contain "require_relative 'production'"
79
+ And the test environment should be configured
228
80
  And the file "config/database.yml" should contain exactly:
229
81
  """
230
82
  common: &common
@@ -249,7 +101,7 @@ Feature: Katapult in general
249
101
  adapter: postgresql
250
102
  encoding: unicode
251
103
  host: localhost
252
- username: root
104
+ username:
253
105
  password:
254
106
 
255
107
  development:
@@ -268,81 +120,17 @@ Feature: Katapult in general
268
120
  parallel: <%= std_opts %> features <%= log_failures %>
269
121
  rerun: -r features --format pretty --strict <%= rerun_failures %> <%= log_failures %>
270
122
  """
271
- And the file "config/deploy.rb" should contain:
272
- """
273
- abort 'You must run this using "bundle exec ..."' unless ENV['BUNDLE_BIN_PATH'] || ENV['BUNDLE_GEMFILE']
274
-
275
- # config valid only for current version of Capistrano
276
- lock '3.4.0'
277
-
278
- # Default value for :format is :pretty
279
- # set :format, :pretty
280
-
281
- set :log_level, :info # %i(debug info error), default: :debug
282
-
283
- # Default value for :pty is false
284
- # set :pty, true
285
-
286
- # Default value for :linked_files is []
287
- # set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
288
- set :linked_files, %w(config/database.yml)
289
-
290
- # Default value for linked_dirs is []
291
- # set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
292
- set :linked_dirs, %w(log public/system)
293
123
 
294
- # Default value for default_env is {}
295
- # set :default_env, { path: "/opt/ruby/bin:$PATH" }
124
+ And Capistrano should be configured
125
+ And Capistrano should be locked to the installed version
296
126
 
297
- set :application, 'katapult_test_app'
298
- set :keep_releases, 10
299
- set :ssh_options, {
300
- forward_agent: true
301
- }
302
- set :scm, :git
303
- set :repo_url, 'git@code.makandra.de:makandra/katapult_test_app.git'
304
-
305
- # set :whenever_roles, :cron
306
- # set :whenever_environment, defer { stage }
307
- # set :whenever_command, 'bundle exec whenever'
308
-
309
- set :maintenance_template_path, 'public/maintenance.html.erb'
310
- """
311
- And the file "config/deploy/staging.rb" should contain:
312
- """
313
- set :stage, :staging
314
-
315
- set :deploy_to, '/var/www/katapult_test_app-staging'
316
- set :rails_env, 'staging'
317
- set :branch, ENV['DEPLOY_BRANCH'] || 'master'
318
-
319
- # server 'example.com', user: 'deploy-user', roles: %w(app web cron db)
320
- """
321
- And the file "config/deploy/production.rb" should contain exactly:
322
- """
323
- set :stage, :production
324
-
325
- set :deploy_to, '/var/www/katapult_test_app'
326
- set :rails_env, 'production'
327
- set :branch, 'production'
328
-
329
- # server 'one.example.com', user: 'deploy-user', roles: %w(app web cron db)
330
- # server 'two.example.com', user: 'deploy-user', roles: %w(app web)
331
- """
127
+ And initializers should be installed
332
128
  And the file "config/initializers/ext.rb" should contain exactly:
333
129
  """
334
- Dir.glob(Rails.root.join('lib/ext/**/*.rb')).each do |filename|
130
+ Dir.glob(Rails.root.join('lib/ext/**/*.rb')).sort.each do |filename|
335
131
  require filename
336
132
  end
337
133
  """
338
- And the file "config/initializers/exception_notification.rb" should contain:
339
- """
340
- ExceptionNotification.configure do |config|
341
-
342
- config.add_notifier :email, {
343
- email_prefix: '[katapult_test_app] ',
344
- exception_recipients: %w[fail@makandra.de],
345
- """
346
134
  And the file "config/secrets.yml" should contain:
347
135
  """
348
136
  staging:
@@ -352,66 +140,6 @@ Feature: Katapult in general
352
140
 
353
141
 
354
142
  # Lib
355
- And the file "lib/capistrano/tasks/db.rake" should contain:
356
- """
357
- namespace :db do
358
- desc 'Warn about pending migrations'
359
- task :warn_if_pending_migrations do
360
- on primary :db do
361
- within current_path do
362
- with rails_env: fetch(:rails_env, 'production') do
363
- rake 'db:warn_if_pending_migrations'
364
- end
365
- end
366
- end
367
- end
368
-
369
- desc 'Do a dump of the DB on the remote machine using dumple'
370
- task :dump do
371
- on primary :db do
372
- within current_path do
373
- execute :dumple, '--fail-gently', fetch(:rails_env, 'production')
374
- end
375
- end
376
- end
377
-
378
- desc 'Show usage of ~/dumps/ on remote host'
379
- task :show_dump_usage do
380
- on primary :db do
381
- info capture :dumple, '-i'
382
- end
383
- end
384
- end
385
- """
386
- And the file "lib/capistrano/tasks/deploy.rake" should contain:
387
- """
388
- namespace :deploy do
389
- desc 'Restart application'
390
- task :restart do
391
- invoke 'passenger:restart'
392
- end
393
-
394
- desc 'Show deployed revision'
395
- task :revision do
396
- on roles :app do
397
- within current_path do
398
- info "Revision: #{ capture :cat, 'REVISION' }"
399
- end
400
- end
401
- end
402
- end
403
- """
404
- And the file "lib/capistrano/tasks/passenger.rake" should contain:
405
- """
406
- namespace :passenger do
407
- desc 'Restart Application'
408
- task :restart do
409
- on roles :app do
410
- execute "sudo passenger-config restart-app --ignore-app-not-running #{ fetch(:deploy_to) }"
411
- end
412
- end
413
- end
414
- """
415
143
  And the file "lib/ext/active_record/find_by_anything.rb" should contain:
416
144
  """
417
145
  ActiveRecord::Base.class_eval do
@@ -426,11 +154,10 @@ Feature: Katapult in general
426
154
  """
427
155
  And the file "lib/ext/action_view/form_for_with_development_errors.rb" should contain:
428
156
  """
429
- if Rails.env == 'development'
157
+ if Rails.env.development?
430
158
 
431
- ActionView::Helpers::FormHelper.class_eval do
432
-
433
- def form_for_with_development_errors(*args, &block)
159
+ ActionView::Helpers::FormHelper.module_eval do
160
+ def form_for_with_development_errors
434
161
  """
435
162
  And the file "lib/ext/active_record/these.rb" should contain:
436
163
  """
@@ -439,8 +166,6 @@ Feature: Katapult in general
439
166
  def self.these(arg)
440
167
  where(id: arg.collect_ids)
441
168
  end
442
-
443
- end
444
169
  """
445
170
  And the file "lib/ext/array/xss_aware_join.rb" should contain:
446
171
  """
@@ -507,84 +232,21 @@ Feature: Katapult in general
507
232
 
508
233
 
509
234
  # Tests
510
- And the file "features/support/env-custom.rb" should contain:
511
- """
512
- require 'spreewald/all_steps'
513
- """
514
- And the file "features/support/cucumber_factory.rb" should contain:
515
- """
516
- Cucumber::Factory.add_steps(self)
517
- """
518
- And the file "features/support/capybara_screenshot.rb" should contain:
519
- """
520
- require 'capybara-screenshot/cucumber'
521
-
522
- # Keep up to the number of screenshots specified in the hash
523
- Capybara::Screenshot.prune_strategy = { keep: 10 }
524
- """
525
- And the file "features/support/database_cleaner.rb" should contain:
526
- """
527
- DatabaseCleaner.clean_with(:deletion) # clean once, now
528
- DatabaseCleaner.strategy = :transaction
529
- Cucumber::Rails::Database.javascript_strategy = :deletion
530
- """
531
- And the file "features/support/factory_girl.rb" should contain:
532
- """
533
- World(FactoryGirl::Syntax::Methods)
534
- """
535
- And a file named "features/support/paths.rb" should exist
536
- And a file named "features/support/selectors.rb" should exist
537
- And the file "spec/rails_helper.rb" should match /^Dir.Rails.root.join.+spec.support/
538
- And the file "spec/support/shoulda_matchers.rb" should contain:
539
- """
540
- require 'shoulda/matchers'
541
-
542
- Shoulda::Matchers.configure do |config|
543
- config.integrate do |with|
544
- with.test_framework :rspec
545
- with.library :rails
546
- end
547
- end
548
- """
549
- And the file "spec/support/factory_girl.rb" should contain:
550
- """
551
- RSpec.configure do |config|
552
- config.include FactoryGirl::Syntax::Methods
553
- end
554
- """
555
- And the file "spec/factories/factories.rb" should contain:
556
- """
557
- FactoryGirl.define do
235
+ And features/support should be prepared
236
+ And spec/support should be prepared
237
+ And a file named "spec/assets/sample.pdf" should exist
238
+ And the file "spec/spec_helper.rb" should contain " mocks.verify_partial_doubles = true"
239
+ But a file named "spec/rails_helper.rb" should not exist
558
240
 
559
- factory :EXAMPLE do
560
- status 'pending'
561
- uuid { SecureRandom.uuid }
562
- sequence(:title) { |i| "Titel #{ i }"}
563
- end
241
+ And the file "spec/factories/factories.rb" should contain:
242
+ """
243
+ FactoryBot.define do
564
244
 
245
+ factory :EXAMPLE do
246
+ status 'pending'
247
+ uuid { SecureRandom.uuid }
248
+ sequence(:title) { |i| "Titel #{ i }"}
565
249
  end
566
- """
567
-
568
-
569
-
570
- # styles
571
- And the file "app/assets/stylesheets/application.sass" should contain:
572
- """
573
- @import compass
574
- @import bootstrap
575
250
 
576
- @import application/blocks/all
577
-
578
- """
579
- And the file "app/assets/stylesheets/application/blocks/_all.sass" should contain exactly:
580
- """
581
- @import items
582
- @import layout
583
- @import navigation
584
- @import tools
585
-
586
- """
587
- And a file named "app/assets/stylesheets/application/blocks/_items.sass" should exist
588
- And a file named "app/assets/stylesheets/application/blocks/_layout.sass" should exist
589
- And a file named "app/assets/stylesheets/application/blocks/_navigation.sass" should exist
590
- And a file named "app/assets/stylesheets/application/blocks/_tools.sass" should exist
251
+ end
252
+ """