incredible 0.0.5.pre → 0.0.6.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/incredible/rule.rb +1 -0
- data/lib/incredible/version.rb +1 -1
- data/lib/incredible/wizard.rb +9 -1
- data/spec/controllers/forms_controller_spec.rb +6 -0
- data/spec/dummy/app/controllers/things_controller.rb +3 -0
- data/spec/dummy/app/rules/step3_rule.rb +8 -0
- data/spec/dummy/config/routes.rb +1 -0
- metadata +41 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 651906a4431f50ed809b13868afa9f65dbc6609e
|
4
|
+
data.tar.gz: 53d4d1473af2dc890781611bd8edb47edaaed2dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6384e7e695087f10e06fc6d20e810d525fdd9b4ca84f61f2976f2c767973af82a5142bc35b7019fa423a46460e047766a45bde7fde8e04f6a48a18be3ce5afc6
|
7
|
+
data.tar.gz: abf45ec7c79d2f7ec77ba1bbdff0f4723ab5f701ead0d1ae075fa6755671c5b10714d18038ccaf48d1284fd3f5c25a2fd2cfcd7d1f183e069f8d4c66250d3ef9
|
data/lib/incredible/rule.rb
CHANGED
data/lib/incredible/version.rb
CHANGED
data/lib/incredible/wizard.rb
CHANGED
@@ -23,12 +23,20 @@ module Incredible
|
|
23
23
|
def load_next_step
|
24
24
|
if step_data.rule
|
25
25
|
@rule = step_data.rule.send(:new, params)
|
26
|
-
|
26
|
+
process_rule
|
27
27
|
elsif step_data.next_step
|
28
28
|
jump_to step_data.next_step
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
def process_rule
|
33
|
+
if @rule.next_step
|
34
|
+
jump_to @rule.next_step
|
35
|
+
elsif @rule.redirect
|
36
|
+
redirect_to @rule.redirect
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
32
40
|
module ClassMethods
|
33
41
|
def form(form_name)
|
34
42
|
wizard_form = Incredible::Form.new(form_name)
|
@@ -28,6 +28,12 @@ describe FormsController, type: :controller do
|
|
28
28
|
(put :update, params: { id: :step1, model: { name: 'Ian' } })
|
29
29
|
).to redirect_to('http://test.host/forms/step2')
|
30
30
|
end
|
31
|
+
|
32
|
+
it 'redirects to another url' do
|
33
|
+
expect(
|
34
|
+
(put :update, params: { id: :step3 })
|
35
|
+
).to redirect_to('http://test.host/things')
|
36
|
+
end
|
31
37
|
end
|
32
38
|
|
33
39
|
context 'next step is specified' do
|
data/spec/dummy/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: incredible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pezholio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -159,9 +159,11 @@ files:
|
|
159
159
|
- spec/dummy/Rakefile
|
160
160
|
- spec/dummy/app/controllers/application_controller.rb
|
161
161
|
- spec/dummy/app/controllers/forms_controller.rb
|
162
|
+
- spec/dummy/app/controllers/things_controller.rb
|
162
163
|
- spec/dummy/app/models/application_record.rb
|
163
164
|
- spec/dummy/app/models/stub_model.rb
|
164
165
|
- spec/dummy/app/rules/step1_rule.rb
|
166
|
+
- spec/dummy/app/rules/step3_rule.rb
|
165
167
|
- spec/dummy/app/views/forms/bar.html.erb
|
166
168
|
- spec/dummy/app/views/forms/foo.html.erb
|
167
169
|
- spec/dummy/app/views/layouts/application.html.erb
|
@@ -226,49 +228,51 @@ signing_key:
|
|
226
228
|
specification_version: 4
|
227
229
|
summary: Build multi-page forms like a General
|
228
230
|
test_files:
|
229
|
-
- spec/
|
230
|
-
- spec/
|
231
|
-
- spec/
|
232
|
-
- spec/
|
233
|
-
- spec/
|
234
|
-
- spec/dummy/app/views/layouts/mailer.text.erb
|
235
|
-
- spec/dummy/app/views/forms/foo.html.erb
|
236
|
-
- spec/dummy/app/views/forms/bar.html.erb
|
237
|
-
- spec/dummy/app/rules/step1_rule.rb
|
238
|
-
- spec/dummy/app/controllers/application_controller.rb
|
239
|
-
- spec/dummy/app/controllers/forms_controller.rb
|
231
|
+
- spec/loader_spec.rb
|
232
|
+
- spec/step_spec.rb
|
233
|
+
- spec/controllers/forms_controller_spec.rb
|
234
|
+
- spec/form_spec.rb
|
235
|
+
- spec/spec_helper.rb
|
240
236
|
- spec/dummy/config.ru
|
241
237
|
- spec/dummy/bin/rake
|
242
|
-
- spec/dummy/bin/update
|
243
|
-
- spec/dummy/bin/bundle
|
244
|
-
- spec/dummy/bin/yarn
|
245
238
|
- spec/dummy/bin/rails
|
239
|
+
- spec/dummy/bin/update
|
246
240
|
- spec/dummy/bin/setup
|
241
|
+
- spec/dummy/bin/yarn
|
242
|
+
- spec/dummy/bin/bundle
|
247
243
|
- spec/dummy/Rakefile
|
244
|
+
- spec/dummy/app/rules/step3_rule.rb
|
245
|
+
- spec/dummy/app/rules/step1_rule.rb
|
246
|
+
- spec/dummy/app/controllers/forms_controller.rb
|
247
|
+
- spec/dummy/app/controllers/application_controller.rb
|
248
|
+
- spec/dummy/app/controllers/things_controller.rb
|
249
|
+
- spec/dummy/app/views/forms/foo.html.erb
|
250
|
+
- spec/dummy/app/views/forms/bar.html.erb
|
251
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
252
|
+
- spec/dummy/app/views/layouts/mailer.html.erb
|
253
|
+
- spec/dummy/app/views/layouts/mailer.text.erb
|
254
|
+
- spec/dummy/app/models/stub_model.rb
|
255
|
+
- spec/dummy/app/models/application_record.rb
|
256
|
+
- spec/dummy/config/routes.rb
|
257
|
+
- spec/dummy/config/environment.rb
|
248
258
|
- spec/dummy/config/spring.rb
|
249
|
-
- spec/dummy/config/forms/form.yml
|
250
|
-
- spec/dummy/config/forms/bad-yaml.yml
|
251
|
-
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
252
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
253
|
-
- spec/dummy/config/initializers/mime_types.rb
|
254
|
-
- spec/dummy/config/initializers/application_controller_renderer.rb
|
255
|
-
- spec/dummy/config/initializers/assets.rb
|
256
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
257
|
-
- spec/dummy/config/initializers/inflections.rb
|
258
|
-
- spec/dummy/config/initializers/cookies_serializer.rb
|
259
|
-
- spec/dummy/config/environments/test.rb
|
260
259
|
- spec/dummy/config/environments/production.rb
|
260
|
+
- spec/dummy/config/environments/test.rb
|
261
261
|
- spec/dummy/config/environments/development.rb
|
262
|
+
- spec/dummy/config/forms/bad-yaml.yml
|
263
|
+
- spec/dummy/config/forms/form.yml
|
264
|
+
- spec/dummy/config/puma.rb
|
262
265
|
- spec/dummy/config/secrets.yml
|
263
|
-
- spec/dummy/config/cable.yml
|
264
266
|
- spec/dummy/config/application.rb
|
265
|
-
- spec/dummy/config/
|
266
|
-
- spec/dummy/config/boot.rb
|
267
|
-
- spec/dummy/config/puma.rb
|
267
|
+
- spec/dummy/config/cable.yml
|
268
268
|
- spec/dummy/config/locales/en.yml
|
269
|
-
- spec/dummy/config/
|
270
|
-
- spec/
|
271
|
-
- spec/
|
272
|
-
- spec/
|
273
|
-
- spec/
|
274
|
-
- spec/
|
269
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
270
|
+
- spec/dummy/config/initializers/assets.rb
|
271
|
+
- spec/dummy/config/initializers/inflections.rb
|
272
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
273
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
274
|
+
- spec/dummy/config/initializers/application_controller_renderer.rb
|
275
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
276
|
+
- spec/dummy/config/initializers/mime_types.rb
|
277
|
+
- spec/dummy/config/boot.rb
|
278
|
+
- spec/dummy/package.json
|