katapult 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +121 -30
  3. data/bin/katapult +59 -21
  4. data/features/binary.feature +29 -16
  5. data/features/katapult.feature +91 -21
  6. data/features/model.feature +46 -2
  7. data/features/step_definitions/file_steps.rb +13 -2
  8. data/features/step_definitions/katapult_steps.rb +9 -3
  9. data/features/step_definitions/rails_steps.rb +5 -4
  10. data/features/step_definitions/test_steps.rb +8 -4
  11. data/features/support/env.rb +6 -4
  12. data/features/wui.feature +16 -1
  13. data/katapult.gemspec +3 -3
  14. data/lib/generators/katapult/basics/basics_generator.rb +51 -26
  15. data/lib/generators/katapult/basics/templates/.gitignore +27 -0
  16. data/lib/generators/katapult/basics/templates/Gemfile +3 -2
  17. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/{_all.css.sass → _all.sass} +0 -0
  18. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/{_items.css.sass → _items.sass} +0 -0
  19. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/{_layout.css.sass → _layout.sass} +0 -0
  20. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/{_navigation.css.sass → _navigation.sass} +0 -0
  21. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/application/blocks/{_tools.css.sass → _tools.sass} +0 -0
  22. data/lib/generators/katapult/basics/templates/app/assets/stylesheets/{application.css.sass → application.sass} +0 -0
  23. data/lib/generators/katapult/basics/templates/config/cucumber.yml +10 -0
  24. data/lib/generators/katapult/basics/templates/config/database.sample.yml +1 -4
  25. data/lib/generators/katapult/basics/templates/config/database.yml +2 -2
  26. data/lib/generators/katapult/basics/templates/config/initializers/exception_notification.rb.tt +16 -0
  27. data/lib/generators/katapult/basics/templates/config/initializers/find_by_anything.rb +19 -0
  28. data/lib/generators/katapult/basics/templates/config/initializers/form_for_with_development_errors.rb +45 -0
  29. data/lib/generators/katapult/basics/templates/features/support/capybara_screenshot.rb +4 -0
  30. data/lib/generators/katapult/basics/templates/features/support/cucumber_factory.rb +1 -0
  31. data/lib/generators/katapult/basics/templates/features/support/database_cleaner.rb +3 -0
  32. data/lib/generators/katapult/basics/templates/features/support/selectors.rb +56 -0
  33. data/lib/generators/katapult/basics/templates/spec/support/shoulda_matchers.rb +8 -0
  34. data/lib/generators/katapult/haml/templates/app/views/layouts/application.html.haml +2 -0
  35. data/lib/generators/katapult/transform/transform_generator.rb +13 -18
  36. data/lib/generators/katapult/w_u_i/w_u_i_generator.rb +14 -1
  37. data/lib/katapult/version.rb +1 -1
  38. metadata +28 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0c8a60d4ea75bbc8ab64191575c2a672d80daf6
4
- data.tar.gz: 8e3b106a9465545b5bccef527bf11358aa0ecd37
3
+ metadata.gz: 83b5fc8065a8a49c75139d70ffd14b8bd9f46153
4
+ data.tar.gz: da1546065c4be23023e74749f5ab80ce217f4a58
5
5
  SHA512:
6
- metadata.gz: e0fa254887044ccb0d59a3d7921e8a6122797f1950a2ed4cd55ccfb5da9e25e5c62ab1fe496cdc7b6dbf5675ab7410ae005e888ac69e9e95667d3ca5c146ed8d
7
- data.tar.gz: 5367cb38a7cd8945ad1c6bb912b0004b17051cbac11a38172c8ea0c1435369e12dbc36f2a3a86a582c6a1ace860515da88572e23a1bd535e0cc3c87657b4d723
6
+ metadata.gz: ce71cf5e9ddd843be50e677070b5591a3f6dc48e2bff36eebc7f86651cbc2a8610f950476c9c47a407431550611202cfe65fd2a20318870f57e6745db9c6ed6a
7
+ data.tar.gz: 2285ddc6da1550f9cbf75165b49d2e6f65ba1894b97286d9b1e1b0f2efa61456e0534c37890b9758f5a37cebb40c02d2968933a8e58e26ade886fd9a0f1b9ed5
data/README.md CHANGED
@@ -3,9 +3,10 @@
3
3
  <img src="katapult.png" width="200px" align="right" />
4
4
 
5
5
 
6
- `Katapult` is a kickstart generator for Rails applications. It creates
7
- application basics and generates (makandra-flavored) code from an application
8
- model, significantly speeding up the initial phase of a Rails project.
6
+ `Katapult` is a kickstart generator for Rails applications. It creates a basic
7
+ application and generates ([makandra-flavored](https://leanpub.com/growing-rails))
8
+ code from an application model, significantly speeding up the initial phase of a
9
+ Rails project.
9
10
 
10
11
  `Katapult` will always support current versions of Ruby and Rails, currently
11
12
  Rails 4.2 and Ruby 2.1.
@@ -13,37 +14,78 @@ Rails 4.2 and Ruby 2.1.
13
14
 
14
15
  ## Installation
15
16
 
16
- As `katapult` is designed to *start* Rails applications, it works best with a
17
- clean new Rails app. To create one, run
17
+ Install the `katapult` gem with
18
18
 
19
- katapult target MY_APPLICATION_NAME
19
+ gem install katapult
20
20
 
21
- This will add the `katapult` gem to the Gemfile and then integrate `katapult`
22
- by running
23
21
 
24
- rails generate katapult:install
25
- rails generate katapult:basics
22
+ ## Usage
26
23
 
24
+ `Katapult` does two separate things:
27
25
 
28
- It will install application basics, such as a `database.yml`, basics styles as
29
- well as RSpec and Cucumber and prepare `lib/katapult/application_model.rb`
30
- where you will draft your application.
26
+ 1. Create a new Rails application, set up with many standard gems, snippets,
27
+ useful configuration, databases etc.
28
+ 2. Generate code from an application model, i.e. create files for models, views,
29
+ controllers, routes, stylesheets
31
30
 
32
- ### Manual installation
33
- You may also integrate the gem into an existing Rails application. Just add it to the Gemfile and run the generators stated above.
31
+ You may use both or only one of them.
34
32
 
35
33
 
36
- ## Usage
34
+ ## 1) Creating a new Rails application
35
+
36
+ Run the following command:
37
+
38
+ katapult new $APPLICATION_NAME
39
+
40
+ In detail, this will:
41
+
42
+ - create a new Rails application (without turbolinks)
43
+ - install common Gems, some of them commented out
44
+ - add a .gitignore and a .ruby-version file
45
+ - set up a `database.yml` file (for MySQL)
46
+ - create basic styles
47
+ - install some handy initializers
48
+ - install RSpec and Cucumber to the application
49
+ - create `lib/katapult/application_model.rb` (needed in Step 2)
50
+
51
+ See `lib/generators/katapult/basics/basics_generator.rb`.
52
+
53
+ ### Using Katapult in existing Rails applications
54
+ `katapult` expects a clean application (that it would usually generate itself).
55
+ If you have an existing Rails application, you *may* use `katapult`, but be
56
+ warned: it is not designed to respect existing files, although it will usually
57
+ ask before overwriting files.
58
+
59
+ To add `katapult` to an existing Rails application, add
60
+ `gem 'katapult', group: :development` to the Gemfile. Then run any of the
61
+ following generators:
62
+
63
+ rails generate katapult:basics # Prepare the app with useful defaults
64
+ rails generate katapult:install # Create application model file
65
+ rails generate katapult:transform lib/katapult/application_model.rb
66
+
67
+
68
+ ## 2) Generating code from an application model
69
+
70
+ > If you only want to use the code generation feature of `katapult`, but did not
71
+ > run `katapult new ...`, you need to add `katapult` to your Gemfile now and
72
+ > install it with `rails generate katapult:install`. See above.
37
73
 
38
- After installation, you find a file `lib/katapult/application_model.rb` where
39
- you will define the properties of your application. Inside this file, use
40
- `katapult`'s simple DSL (domain specific language) to express yourself.
74
+ After installation, you will find a file `lib/katapult/application_model.rb`
75
+ where you will define the properties of your application.
41
76
 
77
+ Inside this file, use `katapult`'s simple DSL (domain specific language) to
78
+ express yourself. When you are done developing the application model, transform
79
+ it into code with:
42
80
 
43
- ### DSL syntax example
44
- The DSL consists of _elements_, e.g. Model or WUI (which stands for *Web User
45
- Interface*). Each `katapult` element has the same syntax, taking a name,
46
- options, and a block:
81
+ katapult fire
82
+
83
+ See an overview of the DSL below. The respective sections hold examples of what
84
+ options are available to each element.
85
+
86
+ ### Generic DSL syntax example
87
+ The DSL consists of _elements_, e.g. `Model` or `WUI` (Web User Interface). Each
88
+ `katapult` element has the same syntax, taking a name, options, and a block:
47
89
 
48
90
  element_type 'name', options: 'example' do |element|
49
91
  element.some_method
@@ -54,17 +96,29 @@ options, and a block:
54
96
  Takes a name and a block:
55
97
 
56
98
  model 'Customer' do |customer|
57
- # ...
99
+ # customer.attr :name etc, see Attribute element
58
100
  end
59
101
 
60
102
 
61
103
  #### Attribute
62
104
  Defined on Model. Takes a name and options:
63
105
 
106
+ # Default type :string
107
+ model.attr :name
108
+
109
+ # Inferred type :email (when attr name matches /email/)
64
110
  model.attr :email
111
+
112
+ # Specify assignable values. Available options: allow_blank, default
65
113
  model.attr :age, type: :integer, assignable_values: 18..99, allow_blank: true
114
+
115
+ # Will be rendered as number_field in forms, and with a € sign in show views
66
116
  model.attr :income, type: :money
117
+
118
+ # All attribute types take an optional default
67
119
  model.attr :homepage, type: :url, default: 'http://www.makandra.de'
120
+
121
+ # Boolean fields are modeled as flags. Default required!
68
122
  model.attr :locked, type: :flag, default: false
69
123
 
70
124
 
@@ -72,22 +126,32 @@ Defined on Model. Takes a name and options:
72
126
  Takes a name, options and a block:
73
127
 
74
128
  wui 'Customer', model: 'User' do |wui|
75
- # ...
129
+ # wui.crud, see Action element
130
+ end
131
+
132
+ # Inferred model name: 'Customer'
133
+ wui 'Customer' do |wui|
134
+ # wui.crud, see Action element
76
135
  end
77
136
 
78
137
 
79
138
  #### Action
80
139
  Defined on WUI. Takes a name and options:
81
140
 
141
+ # Create all the standard rails actions
142
+ wui.crud
143
+
144
+ # Select single Rails actions
82
145
  wui.action :index
83
146
  wui.action :show
84
147
  wui.action :create # also creates :new
85
148
  wui.action :update # also creates :edit
86
149
  wui.action :destroy
87
- wui.crud # creates all the standard rails actions above
150
+
151
+ # Add custom actions
88
152
  wui.action :custom_action, method: :post, scope: :member
89
153
  wui.action :other_action, method: :get, scope: :collection
90
-
154
+
91
155
 
92
156
  ### Navigation
93
157
  Takes a name, will generate a navigation with links to the index pages of all
@@ -98,19 +162,46 @@ WUIs.
98
162
 
99
163
  ## Development
100
164
 
101
- `Katapult` caches a pristine Rails application inside its `tmp/` directory to
165
+ ### Basic information
166
+ `Katapult` is tested with [RSpec](http://rspec.info/) and
167
+ [Cucumber](https://cucumber.io/) + [Aruba](https://github.com/cucumber/aruba)
168
+ ([API-Doc](http://www.rubydoc.info/github/cucumber/aruba/master/)).
169
+
170
+ It caches a pristine Rails application inside its `tmp/` directory to
102
171
  speed up test runs. Keep this in mind, as it may lead to caching issues when
103
172
  switching Ruby versions or installing a new version of the Rails gem.
104
173
 
105
174
  Since `katapult` has full-stack integration tests, it requires a MySQL account.
106
- Create a dedicated account on your MySQL server by running this command in a
107
- MySQL console (as-is):
175
+ Create a dedicated account on your local MySQL server by running this command in
176
+ a MySQL console (as-is):
108
177
 
109
178
  GRANT ALL ON *.* TO 'katapult'@'localhost' IDENTIFIED BY 'secret';
110
179
 
111
180
  The user `katapult` is hereby granted any action (SELECT, UPDATE, etc. except
112
181
  for granting privileges) on any database and table (`*.*`).
113
182
 
183
+ ### Continuing development
184
+ When you continue development on `katapult`, remove its `tmp/` directory first.
185
+ It contains cached data that might lead to confusion.
186
+
187
+ ### Debugging
188
+ Add the `@announce-output` tag to `katapult` features in order to have any output
189
+ logged to your terminal.
190
+
191
+ To precisely debug errors occurring _inside_ the generated application, you may
192
+ cd to `tmp/aruba/katapult_test_app`. Run the failing command manually.
193
+
194
+ Note that after running a katapult feature, you need to call
195
+ `cd ../../aruba/katapult_test_app` inside the generated app terminal. This is
196
+ required because the `tmp/aruba` directory is being wiped before each scenario.
197
+
198
+ ### Typical errors
199
+ - Timeout error because of a script waiting for user input
200
+ - Executing (bash) commands in the test application without resetting the
201
+ katapult gem's Bundler settings. Wrap into `Bundler.with_clean_env { }`.
202
+ - Spring running inside the test application encumbers parallel_tests
203
+ - An outdated Rails application in `tmp/cached_test_app`
204
+
114
205
 
115
206
  ## Credits
116
207
 
data/bin/katapult CHANGED
@@ -1,44 +1,82 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # This script simplifies the usage of `katapult` by grouping relevant actions
4
+ # that the user else had to perform manually.
5
+ # See bottom for USAGE.
6
+
3
7
  require_relative '../lib/katapult/util'
8
+ require 'bundler'
9
+
10
+ def pink_puts(*args)
11
+ message = "\n> #{ args.join ' ' }"
12
+ Kernel.puts "\e[35m#{ message }\e[0m" # pink
13
+ end
4
14
 
5
- case (command = ARGV.shift)
6
- when 'target'
15
+ # With clean Bundler env
16
+ def run(command)
17
+ Bundler.with_clean_env { system command }
18
+ end
19
+
20
+ case (transform_command = ARGV.shift)
21
+ when 'new'
22
+ interactive = !ARGV.delete('--non-interactive')
7
23
  app_name = ARGV.shift
24
+ basics_command = 'bundle exec rails generate katapult:basics'
8
25
 
9
- puts 'Creating new Rails application ...'
10
- system "rails new #{app_name} --skip-test-unit --skip-bundle --database mysql"
26
+ if interactive
27
+ pink_puts 'Please enter your database user: '
28
+ basics_command << ' --db-user ' << gets.chomp
29
+
30
+ pink_puts 'Please enter your database password: '
31
+ basics_command << ' --db-password ' << gets.chomp
32
+ end
33
+
34
+ pink_puts 'Creating new Rails application ...'
35
+ run "rails new #{ app_name } --skip-test-unit --skip-bundle --database mysql"
11
36
 
12
37
  Dir.chdir app_name
13
38
 
14
- puts
15
- puts 'Initializing git repository ...'
16
- system 'git init'
17
- Katapult::Util.git_commit "rails new #{app_name}"
39
+ pink_puts 'Initializing git repository ...'
40
+ run 'git init'
41
+ Katapult::Util.git_commit "rails new #{ app_name }"
18
42
 
19
- puts
20
- puts 'Installing katapult ...'
43
+ pink_puts 'Installing katapult ...'
21
44
  File.open('Gemfile', 'a') do |file|
22
- file.puts "gem 'katapult'#{ ENV['KATAPULT_GEMFILE_OPTIONS'] }"
45
+ file.puts "gem 'katapult'#{ ENV['KATAPULT_GEMFILE_OPTIONS'] }, group: :development"
23
46
  end
24
- system 'bundle install'
25
- system 'bundle exec rails generate katapult:install'
47
+ run 'bundle install'
48
+ run 'bundle exec rails generate katapult:install'
26
49
  Katapult::Util.git_commit 'rails generate katapult:install'
27
50
 
28
- puts
29
- puts 'Generating katapult basics ...'
30
- system 'bundle exec rails generate katapult:basics'
51
+ pink_puts 'Generating katapult basics ...'
52
+ run basics_command
31
53
  Katapult::Util.git_commit 'rails generate katapult:basics'
32
54
 
33
- puts
34
- puts 'Done.'
55
+ pink_puts <<-INSTRUCTIONS
56
+ Application initialization done.
57
+
58
+ Next step: Model your application in lib/katapult/application_model.rb and
59
+ transform it into code by running `katapult fire`.
60
+ INSTRUCTIONS
35
61
 
36
62
  when 'fire'
37
63
  app_model_path = 'lib/katapult/application_model.rb'
64
+ transform_command = 'bin/rails generate katapult:transform ' + app_model_path
65
+
66
+ pink_puts 'Loading katapult ...'
67
+ run transform_command
68
+ Katapult::Util.git_commit transform_command
69
+
70
+ pink_puts <<-INSTRUCTIONS
71
+ Model transformation done.
38
72
 
39
- puts 'Loading katapult ...'
40
- system 'bin/rails generate katapult:transform ' + app_model_path
73
+ Now boot up your development server (e.g. with `rails server`) and try your
74
+ kickstarted application in the browser!
75
+ INSTRUCTIONS
41
76
 
42
77
  else
43
- puts 'Usage: katapult [target APP_NAME | fire]'
78
+ puts <<-USAGE
79
+ Usage: katapult [new APP_NAME | fire]
80
+ Hint: Suppress database credentials prompt with `--non-interactive`
81
+ USAGE
44
82
  end
@@ -1,13 +1,21 @@
1
1
  Feature: Katapult binary `katapult`
2
2
 
3
3
  Scenario: Start new Rails application
4
- Given the default aruba timeout is 120 seconds
4
+ Given the default aruba exit timeout is 120 seconds
5
5
 
6
- When I successfully run `katapult target binary_test`
6
+ When I run `katapult new binary_test` interactively
7
+ And I type "katapult"
8
+ And I type "secret"
7
9
  Then the output should contain "Creating new Rails application"
8
10
  And the output should contain "Installing katapult"
9
11
  And the output should contain "Generating katapult basics"
10
- And the output should contain "Done."
12
+ And the output should contain:
13
+ """
14
+ Application initialization done.
15
+
16
+ Next step: Model your application in lib/katapult/application_model.rb and
17
+ transform it into code by running `katapult fire`.
18
+ """
11
19
 
12
20
  When I cd to "binary_test"
13
21
 
@@ -15,9 +23,14 @@ Feature: Katapult binary `katapult`
15
23
  Then the file "Gemfile" should contain "gem 'katapult'"
16
24
  And a file named "lib/katapult/application_model.rb" should exist
17
25
 
18
- # test whether the application is already bundled
19
- When I run `bundle check`
20
- Then the output should contain "The Gemfile's dependencies are satisfied"
26
+ # test correct insertion of database credentials
27
+ And the file "config/database.yml" should contain "username: katapult"
28
+ And the file "config/database.yml" should contain "password: secret"
29
+
30
+ # Not working, probably because Bundler sees an empty BUNDLER_GEMFILE var
31
+ # # test whether the application is already bundled
32
+ # When I run `bundle check`
33
+ # Then the output should contain "The Gemfile's dependencies are satisfied"
21
34
 
22
35
  # test whether katapult made git commits
23
36
  When I run `git log`
@@ -26,21 +39,15 @@ Feature: Katapult binary `katapult`
26
39
  And the output should contain "rails generate katapult:basics"
27
40
  And the output should contain "Author: katapult <katapult@makandra.com>"
28
41
 
29
- And the output should contain:
30
- """
31
- Next step: Model your application in lib/katapult/application_model.rb and
32
- trigger the code generation by running `katapult fire`.
33
- """
34
-
35
42
 
36
43
  Scenario: Forget to pass application name
37
- When I run `katapult target # without app name`
44
+ When I run `katapult new --non-interactive # Without app name`
38
45
  Then the output should contain "No value provided for required arguments 'app_path'"
39
46
 
40
47
 
41
48
  Scenario: Run without arguments
42
49
  When I run `katapult # without arguments`
43
- Then the output should contain "Usage: katapult [target APP_NAME | fire]"
50
+ Then the output should contain "Usage: katapult [new APP_NAME | fire]"
44
51
 
45
52
 
46
53
  Scenario: Transform the application model
@@ -55,6 +62,12 @@ Feature: Katapult binary `katapult`
55
62
 
56
63
  And the output should contain:
57
64
  """
58
- You're done! Now boot up your development server (e.g. with `rails server`)
59
- and try your kickstarted application in the browser.
65
+ Model transformation done.
66
+
67
+ Now boot up your development server (e.g. with `rails server`) and try your
68
+ kickstarted application in the browser!
60
69
  """
70
+
71
+ When I run `git log`
72
+ Then the output should contain "rails generate katapult:transform lib/katapult/application_model.rb"
73
+ And the output should contain "Author: katapult <katapult@makandra.com>"
@@ -32,21 +32,35 @@ Feature: Katapult in general
32
32
 
33
33
  Scenario: Generate basic files and settings
34
34
  Given I install katapult
35
+
35
36
  When I generate katapult basics
36
37
  Then the file ".ruby-version" should contain "2.1.5"
37
- And the file "Gemfile" should contain exactly:
38
+
39
+
40
+ And the file "config/cucumber.yml" should contain:
41
+ """
42
+ default: <%= std_opts %> features
43
+ wip: --tags @wip:3 --wip features
44
+ parallel: <%= std_opts %> features <%= log_failures %>
45
+ rerun: -r features --format pretty --strict <%= rerun_failures %> <%= log_failures %>
46
+ """
47
+
48
+
49
+ And the file ".gitignore" should contain "config/database.yml"
50
+ And the file "Gemfile" should contain "gem 'rails', '4.2.4'"
51
+ And the file "Gemfile" should contain exactly:
38
52
  """
39
53
  source 'https://rubygems.org'
40
54
 
41
55
  # from original Gemfile
42
- gem 'rails', '4.2.1'
43
- gem 'mysql2'
56
+ gem 'rails', '4.2.4'
44
57
  gem 'jquery-rails'
45
58
  gem 'jbuilder', '~> 2.0'
46
59
  gem 'katapult', path: '../../..'
47
60
 
48
61
  # engines
49
62
  gem 'haml-rails'
63
+ gem 'mysql2', '~> 0.3.18' # Work around require-error in Rails 4.2
50
64
 
51
65
  # internal
52
66
  gem 'exception_notification'
@@ -88,6 +102,7 @@ Feature: Katapult in general
88
102
  gem 'binding_of_caller'
89
103
  gem 'thin'
90
104
 
105
+ gem 'parallel_tests'
91
106
  gem 'guard-livereload', require: false
92
107
  gem 'rack-livereload'
93
108
  gem 'spring-commands-rspec'
@@ -102,15 +117,14 @@ Feature: Katapult in general
102
117
  end
103
118
 
104
119
  group :test do
105
- gem 'parallel_tests'
106
120
  gem 'database_cleaner'
107
121
  gem 'timecop'
108
122
  gem 'launchy'
109
123
 
110
124
  gem 'capybara'
125
+ gem 'capybara-screenshot'
111
126
  gem 'cucumber-rails', require: false
112
127
  gem 'cucumber_factory'
113
- gem 'cucumber_spinner'
114
128
  gem 'selenium-webdriver'
115
129
  gem 'spreewald'
116
130
 
@@ -120,7 +134,11 @@ Feature: Katapult in general
120
134
 
121
135
  """
122
136
 
123
- And the file "config/database.yml" should contain exactly:
137
+
138
+
139
+ # Config
140
+ And the file "config/application.rb" should contain "config.time_zone = 'Berlin'"
141
+ And the file "config/database.yml" should contain exactly:
124
142
  """
125
143
  common: &common
126
144
  adapter: mysql2
@@ -135,10 +153,8 @@ Feature: Katapult in general
135
153
  test: &test
136
154
  <<: *common
137
155
  database: katapult_test_app_test<%= ENV['TEST_ENV_NUMBER'] %>
138
-
139
- cucumber:
140
- <<: *test
141
156
  """
157
+
142
158
  And the file "config/database.sample.yml" should contain exactly:
143
159
  """
144
160
  common: &common
@@ -151,30 +167,84 @@ Feature: Katapult in general
151
167
  <<: *common
152
168
  database: katapult_test_app_development
153
169
 
154
- test: &test
170
+ test:
155
171
  <<: *common
156
172
  database: katapult_test_app_test<%= ENV['TEST_ENV_NUMBER'] %>
173
+ """
174
+
175
+ And the file "config/cucumber.yml" should contain:
176
+ """
177
+ default: <%= std_opts %> features
178
+ wip: --tags @wip:3 --wip features
179
+ parallel: <%= std_opts %> features <%= log_failures %>
180
+ rerun: -r features --format pretty --strict <%= rerun_failures %> <%= log_failures %>
181
+ """
182
+ And the file "config/initializers/find_by_anything.rb" should contain:
183
+ """
184
+ ActiveRecord::Base.class_eval do
157
185
 
158
- cucumber:
159
- <<: *test
186
+ def self.find_by_anything(identifier)
187
+ """
188
+ And the file "config/initializers/exception_notification.rb" should contain:
189
+ """
190
+ ExceptionNotification.configure do |config|
160
191
 
192
+ config.add_notifier :email, {
193
+ email_prefix: '[katapult_test_app] ',
194
+ exception_recipients: %w[fail@makandra.de],
161
195
  """
196
+ And the file "config/initializers/form_for_with_development_errors.rb" should contain:
197
+ """
198
+ if Rails.env == 'development'
199
+
200
+ ActionView::Helpers::FormHelper.class_eval do
201
+
202
+ def form_for_with_development_errors(*args, &block)
203
+ """
204
+
205
+
162
206
 
207
+ # Tests
163
208
  And the file "features/support/env-custom.rb" should contain:
164
209
  """
165
210
  require 'spreewald/all_steps'
166
211
  """
167
- And a file named "features/support/paths.rb" should exist
168
- And the file "spec/rails_helper.rb" should contain:
212
+ And the file "features/support/cucumber_factory.rb" should contain:
213
+ """
214
+ Cucumber::Factory.add_steps(self)
215
+ """
216
+ And the file "features/support/capybara_screenshot.rb" should contain:
217
+ """
218
+ require 'capybara-screenshot/cucumber'
219
+
220
+ # Keep up to the number of screenshots specified in the hash
221
+ Capybara::Screenshot.prune_strategy = { keep: 10 }
222
+ """
223
+ And the file "features/support/database_cleaner.rb" should contain:
224
+ """
225
+ DatabaseCleaner.clean_with(:deletion) # clean once, now
226
+ DatabaseCleaner.strategy = :transaction
227
+ Cucumber::Rails::Database.javascript_strategy = :deletion
228
+ """
229
+ And a file named "features/support/paths.rb" should exist
230
+ And a file named "features/support/selectors.rb" should exist
231
+ And the file "spec/rails_helper.rb" should match /^Dir.Rails.root.join.+spec.support/
232
+ And the file "spec/support/shoulda_matchers.rb" should contain:
169
233
  """
170
- require 'rspec/rails'
171
234
  require 'shoulda/matchers'
235
+
236
+ Shoulda::Matchers.configure do |config|
237
+ config.integrate do |with|
238
+ with.test_framework :rspec
239
+ with.library :rails
240
+ end
241
+ end
172
242
  """
173
243
 
174
244
 
175
245
 
176
246
  # styles
177
- And the file "app/assets/stylesheets/application.css.sass" should contain:
247
+ And the file "app/assets/stylesheets/application.sass" should contain:
178
248
  """
179
249
  @import compass
180
250
  @import bootstrap
@@ -182,7 +252,7 @@ Feature: Katapult in general
182
252
  @import application/blocks/all
183
253
 
184
254
  """
185
- And the file "app/assets/stylesheets/application/blocks/_all.css.sass" should contain exactly:
255
+ And the file "app/assets/stylesheets/application/blocks/_all.sass" should contain exactly:
186
256
  """
187
257
  @import items
188
258
  @import layout
@@ -190,10 +260,10 @@ Feature: Katapult in general
190
260
  @import tools
191
261
 
192
262
  """
193
- And a file named "app/assets/stylesheets/application/blocks/_items.css.sass" should exist
194
- And a file named "app/assets/stylesheets/application/blocks/_layout.css.sass" should exist
195
- And a file named "app/assets/stylesheets/application/blocks/_navigation.css.sass" should exist
196
- And a file named "app/assets/stylesheets/application/blocks/_tools.css.sass" should exist
263
+ And a file named "app/assets/stylesheets/application/blocks/_items.sass" should exist
264
+ And a file named "app/assets/stylesheets/application/blocks/_layout.sass" should exist
265
+ And a file named "app/assets/stylesheets/application/blocks/_navigation.sass" should exist
266
+ And a file named "app/assets/stylesheets/application/blocks/_tools.sass" should exist
197
267
 
198
268
  # And the file "config/deploy.rb" should contain exactly:
199
269
  # """