wicked 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +2 -1
- data/CHANGELOG.md +5 -0
- data/README.md +13 -13
- data/VERSION +1 -1
- data/lib/wicked.rb +2 -0
- data/lib/wicked/controller/concerns/render_redirect.rb +1 -0
- data/lib/wicked/wizard.rb +2 -1
- data/lib/wicked/wizard/translated.rb +4 -7
- data/test/controllers/bar_controller_test.rb +13 -0
- data/test/dummy/app/controllers/redirect_to_finish_flash_controller.rb +22 -0
- data/test/dummy/app/views/redirect_to_finish_flash/index.html.erb +3 -0
- data/test/dummy/app/views/redirect_to_finish_flash/last_step.html.erb +1 -0
- data/test/dummy/app/views/step_positions/_step_position.html.erb +2 -0
- data/test/dummy/config/routes.rb +1 -0
- data/test/integration/dynamic_steps_test.rb +2 -2
- data/test/integration/helpers_test.rb +5 -5
- data/test/integration/i18n_test.rb +14 -14
- data/test/integration/jump_test.rb +2 -2
- data/test/integration/navigation_test.rb +10 -10
- data/test/integration/nested_builder_test.rb +4 -4
- data/test/integration/redirect_to_finish_flash_test.rb +11 -0
- data/test/integration/redirect_to_next_test.rb +6 -6
- data/test/integration/steps_test.rb +14 -14
- data/test/test_helper.rb +7 -1
- data/wicked.gemspec +11 -5
- metadata +28 -42
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1830f26475c47d09c4ef96c6da9b8ea9ed4229e5
|
4
|
+
data.tar.gz: 26aacf9b06cf1a3640850fedac063a34640c9219
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9af83dcfe6c322566f4ef3eccacccaa697d13730782b3fb3a2dcadf97c2816000db720fe77a6d49e4ba2511b5a84607992abda5bf1c59b52fdd99212a952578a
|
7
|
+
data.tar.gz: 05c1f6c605724a99df9320a5e0e1f16372c2f762b834e70bdc9c23a776dca161e614603f357074fe4349f20afba05478608bbb674bd187f8359195833c7c4126
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Use wicked to make your Rails controllers into step-by-step wizards. To see Wick
|
|
9
9
|
|
10
10
|
## Why
|
11
11
|
|
12
|
-
Many times I'm left wanting a RESTful way to display a step by step process that may or not be associated with a resource. Wicked gives the flexibility to do what I want while hiding all the really nasty stuff you shouldn't do in a controller to make this possible. At
|
12
|
+
Many times I'm left wanting a RESTful way to display a step by step process that may or not be associated with a resource. Wicked gives the flexibility to do what I want while hiding all the really nasty stuff you shouldn't do in a controller to make this possible. At its core Wicked is a RESTful(ish) state machine, but you don't need to know that, just use it.
|
13
13
|
|
14
14
|
## Install
|
15
15
|
|
@@ -121,7 +121,7 @@ class AfterSignupController < ApplicationController
|
|
121
121
|
when :confirm_password
|
122
122
|
@user.update_attributes(params[:user])
|
123
123
|
end
|
124
|
-
sign_in(@user, :
|
124
|
+
sign_in(@user, bypass: true) # needed for devise
|
125
125
|
render_wizard @user
|
126
126
|
end
|
127
127
|
end
|
@@ -133,7 +133,7 @@ We're passing `render_wizard` our `@user` object here. If you pass an object int
|
|
133
133
|
To get to this update action, you simply need to submit a form that PUT's to the same url
|
134
134
|
|
135
135
|
```erb
|
136
|
-
<%= form_for @user, :
|
136
|
+
<%= form_for @user, url: wizard_path, method: :put do |f| %>
|
137
137
|
<%= f.password_field :password %>
|
138
138
|
<%= f.password_field :password_confirmation %>
|
139
139
|
|
@@ -182,9 +182,11 @@ Controller Tidbits:
|
|
182
182
|
|
183
183
|
```ruby
|
184
184
|
steps :first, :second # Sets the order of steps
|
185
|
-
step # Gets
|
186
|
-
next_step # Gets
|
185
|
+
step # Gets current step
|
186
|
+
next_step # Gets next step
|
187
|
+
previous_step # Gets previous step
|
187
188
|
skip_step # Tells render_wizard to skip to the next logical step
|
189
|
+
jump_to(:specific_step) # Jump to :specific_step
|
188
190
|
render_wizard # Renders the current step
|
189
191
|
render_wizard(@user) # Shows next_step if @user.save, otherwise renders current step
|
190
192
|
```
|
@@ -220,7 +222,7 @@ end
|
|
220
222
|
|
221
223
|
```ruby
|
222
224
|
# Test find_friends block of show action
|
223
|
-
get :show, :
|
225
|
+
get :show, id: :find_friends
|
224
226
|
|
225
227
|
# Test find_friends block of update action
|
226
228
|
put :update, {'id' => 'find_friends', "user" => { "id" => @user.id.to_s }}
|
@@ -229,7 +231,7 @@ put :update, {'id' => 'find_friends', "user" => { "id" => @user.id.to_s }}
|
|
229
231
|
|
230
232
|
### Internationalization of URLS (I18n)
|
231
233
|
|
232
|
-
If your site works in multiple languages, or if you just want more control over how your
|
234
|
+
If your site works in multiple languages, or if you just want more control over how your URLs look you can now use I18n with wicked. To do so you need to replace this:
|
233
235
|
|
234
236
|
```ruby
|
235
237
|
include Wicked::Wizard
|
@@ -275,7 +277,7 @@ end
|
|
275
277
|
|
276
278
|
For a screencast on setting up and using I18n check out [Railscasts](http://railscasts.com/episodes/138-i18n-revised). You can also read the [free I18n Rails Guide](http://guides.rubyonrails.org/i18n.html).
|
277
279
|
|
278
|
-
Now when you visit your controller with the proper locale set your
|
280
|
+
Now when you visit your controller with the proper locale set your URLs should be more readable like `/after_signup/uno` and `after_signup/dos`.
|
279
281
|
|
280
282
|
Wicked expects your files to be named the same as your keys, so when a user visits `after_signup/dos` with the `es` locale it will render the `second.html.erb` file.
|
281
283
|
|
@@ -322,7 +324,7 @@ If you need any values to match the values set directly in your controller,
|
|
322
324
|
or the names of your files (i.e. `views/../confirm_password.html.erb`, then you need
|
323
325
|
to use `wizard_value` method.
|
324
326
|
|
325
|
-
## Custom
|
327
|
+
## Custom URLs
|
326
328
|
|
327
329
|
Very similar to using I18n from above but instead of making new files for different languages, you can stick with one language. Make sure you are using the right module:
|
328
330
|
|
@@ -340,7 +342,7 @@ en:
|
|
340
342
|
second: "if_you_are_popular_add_friends"
|
341
343
|
```
|
342
344
|
|
343
|
-
Now you can change the values in the
|
345
|
+
Now you can change the values in the URLs to whatever you want without changing your controller or your files, just modify your `en.yml`. If you're not using English you can set your default_locale to something other than `en` in your `config/application.rb` file.
|
344
346
|
|
345
347
|
```ruby
|
346
348
|
config.i18n.default_locale = :de
|
@@ -372,8 +374,6 @@ def set_steps
|
|
372
374
|
end
|
373
375
|
```
|
374
376
|
|
375
|
-
Note: Do not pass user submitted params directly into `self.steps` while using the custom or translated urls. The translator calls `to_sym` on steps provided, and if a user is allowed to submit arbitrary symbols, they could flood the take down your production app by filling up the symbol table. So, just don't do it.
|
376
|
-
|
377
377
|
## Keywords
|
378
378
|
|
379
379
|
There are a few "magical" keywords that will take you to the first step,
|
@@ -396,7 +396,7 @@ change the step names, they are expected to be strings (not symbols).
|
|
396
396
|
|
397
397
|
## About
|
398
398
|
|
399
|
-
Please poke around the source code, if you see easier ways to get a Rails controller
|
399
|
+
Please poke around the source code, if you see easier ways to get a Rails controller to do what I want, let me know.
|
400
400
|
|
401
401
|
If you have a question file an issue or, find me on the Twitters [@schneems](http://twitter.com/schneems).
|
402
402
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
data/lib/wicked.rb
CHANGED
@@ -44,6 +44,7 @@ module Wicked::Controller::Concerns::RenderRedirect
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def redirect_to_finish_wizard(options = {})
|
47
|
+
Rails.logger.debug("Wizard has finished, redirecting to finish_wizard_path: #{finish_wizard_path.inspect}")
|
47
48
|
redirect_to finish_wizard_path, options
|
48
49
|
end
|
49
50
|
end
|
data/lib/wicked/wizard.rb
CHANGED
@@ -31,7 +31,8 @@ module Wicked
|
|
31
31
|
|
32
32
|
# forward to first step with whatever params are provided
|
33
33
|
def index
|
34
|
-
|
34
|
+
query_string = "?#{request.query_parameters.to_query}" if request.query_parameters.any?
|
35
|
+
redirect_to "#{ wizard_path(steps.first) }#{ query_string || '' }"
|
35
36
|
end
|
36
37
|
|
37
38
|
# returns the canonical value for a step name, needed for translation support
|
@@ -28,7 +28,7 @@ module Wicked
|
|
28
28
|
@wizard_translations ||= steps.inject(ActiveSupport::OrderedHash.new) do |hash, step|
|
29
29
|
step = step.to_s.split(".").last
|
30
30
|
translation = wizard_translate(step)
|
31
|
-
hash[translation] = step.
|
31
|
+
hash[translation] = step.to_s
|
32
32
|
hash
|
33
33
|
end
|
34
34
|
end
|
@@ -39,11 +39,8 @@ module Wicked
|
|
39
39
|
# wicked:
|
40
40
|
# first: "uno"
|
41
41
|
#
|
42
|
-
# wizard_translate(
|
42
|
+
# wizard_translate("first") # => :uno
|
43
43
|
def wizard_translate(step_name)
|
44
|
-
I18n.t("wicked.#{step_name}", :raise => true).to_sym
|
45
|
-
rescue I18n::MissingTranslationData
|
46
|
-
# don't symbolize if key doesn't exist
|
47
44
|
I18n.t("wicked.#{step_name}")
|
48
45
|
end
|
49
46
|
|
@@ -53,10 +50,10 @@ module Wicked
|
|
53
50
|
# wicked:
|
54
51
|
# first: "uno"
|
55
52
|
#
|
56
|
-
# wizard_value(
|
53
|
+
# wizard_value("uno") # => :first
|
57
54
|
#
|
58
55
|
def wizard_value(step_name)
|
59
|
-
wizard_translations[step_name]
|
56
|
+
wizard_translations["#{step_name}"]
|
60
57
|
end
|
61
58
|
|
62
59
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class BarControllerTest < ActionController::TestCase
|
4
|
+
test 'index redirects to the first step' do
|
5
|
+
get :index
|
6
|
+
assert_redirected_to bar_path(:first)
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'index redirects to the first step, preserving query args' do
|
10
|
+
get :index, :some => 'arguments', :were => 'passed'
|
11
|
+
assert_redirected_to bar_path(:first, :some => 'arguments', :were => 'passed')
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class RedirectToFinishFlashController < ApplicationController
|
2
|
+
include Wicked::Wizard
|
3
|
+
|
4
|
+
steps :first, :second, :last_step
|
5
|
+
|
6
|
+
def index
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
def show
|
11
|
+
render_wizard
|
12
|
+
end
|
13
|
+
|
14
|
+
def update
|
15
|
+
render_wizard(nil, notice: 'Flash message notice')
|
16
|
+
end
|
17
|
+
|
18
|
+
def finish_wizard_path
|
19
|
+
redirect_to_finish_flash_index_path
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= link_to "Next", next_wizard_path, :method => :put %>
|
data/test/dummy/config/routes.rb
CHANGED
@@ -4,7 +4,7 @@ class DynamicStepsTest < ActiveSupport::IntegrationCase
|
|
4
4
|
test 'set dynamic steps from params' do
|
5
5
|
steps = ['first', 'second']
|
6
6
|
visit dynamic_steps_path(:steps => steps)
|
7
|
-
|
8
|
-
|
7
|
+
assert_has_content?(steps.first.inspect)
|
8
|
+
assert_has_content?(steps.inspect)
|
9
9
|
end
|
10
10
|
end
|
@@ -6,34 +6,34 @@ class HelpersTest < ActiveSupport::IntegrationCase
|
|
6
6
|
step = :first
|
7
7
|
visit(bar_path(step))
|
8
8
|
click_link 'skip'
|
9
|
-
|
9
|
+
assert_has_content?('second')
|
10
10
|
end
|
11
11
|
|
12
12
|
test 'wizard_path' do
|
13
13
|
step = :first
|
14
14
|
visit(bar_path(step))
|
15
15
|
click_link 'current'
|
16
|
-
|
16
|
+
assert_has_content?(step.to_s)
|
17
17
|
end
|
18
18
|
|
19
19
|
test 'wizard_path with symbol arg' do
|
20
20
|
step = :first
|
21
21
|
visit(bar_path(step))
|
22
22
|
click_link 'last'
|
23
|
-
|
23
|
+
assert_has_content?('last_step')
|
24
24
|
end
|
25
25
|
|
26
26
|
test 'previous_wizard_path' do
|
27
27
|
step = :second
|
28
28
|
visit(bar_path(step))
|
29
29
|
click_link 'previous'
|
30
|
-
|
30
|
+
assert_has_content?("first")
|
31
31
|
end
|
32
32
|
|
33
33
|
test 'wizard_steps' do
|
34
34
|
step = :last_step
|
35
35
|
visit(bar_path(step))
|
36
|
-
|
36
|
+
assert_has_content?("step 3 of 3")
|
37
37
|
end
|
38
38
|
|
39
39
|
end
|
@@ -7,39 +7,39 @@ class I18nTest < ActiveSupport::IntegrationCase
|
|
7
7
|
test 'renders in spanish' do
|
8
8
|
step = :uno
|
9
9
|
visit(i18n_path(step, :locale => :es))
|
10
|
-
|
10
|
+
assert_has_content?("Hey ya'll we're looking at: uno")
|
11
11
|
assert has_link?('hello', :href => i18n_path(:dos))
|
12
|
-
|
12
|
+
assert_has_content?('uno step is the current step') # current_step?
|
13
13
|
assert true # past_step?
|
14
|
-
|
15
|
-
|
14
|
+
assert_has_content?('dos step is a future step') # future_step?
|
15
|
+
assert_has_content?('último_paso step is a future step') # future_step?
|
16
16
|
assert true # previous_step?
|
17
|
-
|
17
|
+
assert_has_content?('dos step is the next step') # next_step?
|
18
18
|
end
|
19
19
|
|
20
20
|
test 'renders in english' do
|
21
21
|
step = :first
|
22
22
|
visit(i18n_path(step, :locale => :en))
|
23
|
-
|
23
|
+
assert_has_content?("Hey ya'll we're looking at: first")
|
24
24
|
assert has_link?('hello', :href => i18n_path(:second))
|
25
25
|
|
26
|
-
|
26
|
+
assert_has_content?('first step is the current step') # current_step?
|
27
27
|
assert true # past_step?
|
28
|
-
|
29
|
-
|
28
|
+
assert_has_content?('last_step step is a future step') # future_step?
|
29
|
+
assert_has_content?('second step is a future step') # future_step?
|
30
30
|
assert true # previous_step?
|
31
|
-
|
31
|
+
assert_has_content?('second step is the next step') # next_step?
|
32
32
|
end
|
33
33
|
|
34
34
|
test 'wizard_value works on i18n pages' do
|
35
35
|
step = :dos
|
36
36
|
visit(i18n_path(step, :locale => :es))
|
37
|
-
|
38
|
-
|
37
|
+
assert_has_content?("wizard_value for first: first")
|
38
|
+
assert_has_content?("wizard_value for second: second")
|
39
39
|
|
40
40
|
step = :second
|
41
41
|
visit(i18n_path(step, :locale => :en))
|
42
|
-
|
43
|
-
|
42
|
+
assert_has_content?("wizard_value for first: first")
|
43
|
+
assert_has_content?("wizard_value for second: second")
|
44
44
|
end
|
45
45
|
end
|
@@ -4,13 +4,13 @@ class JumpNavigationTest < ActiveSupport::IntegrationCase
|
|
4
4
|
test 'consider jump_to when calling render_wizard with resource' do
|
5
5
|
step = :first
|
6
6
|
visit(jump_path(step, :resource => {:save => true}, :jump_to => :last_step))
|
7
|
-
|
7
|
+
assert_has_content?('last_step')
|
8
8
|
end
|
9
9
|
|
10
10
|
test 'disregard jump_to when saving the resource fails' do
|
11
11
|
step = :first
|
12
12
|
visit(jump_path(step, :resource => {:save => false}, :jump_to => :last_step))
|
13
|
-
|
13
|
+
assert_has_content?('first')
|
14
14
|
assert !has_content?('last_step')
|
15
15
|
end
|
16
16
|
end
|
@@ -3,40 +3,40 @@ require 'test_helper'
|
|
3
3
|
class IncludeNavigationTest < ActiveSupport::IntegrationCase
|
4
4
|
test 'index forwards to first step by default' do
|
5
5
|
visit(bar_index_path)
|
6
|
-
|
6
|
+
assert_has_content?("first")
|
7
7
|
end
|
8
8
|
|
9
9
|
test 'index forwards params to first step' do
|
10
10
|
visit(bar_index_path(:foo => "first"))
|
11
|
-
|
11
|
+
assert_has_content?("params[:foo] first")
|
12
12
|
end
|
13
13
|
|
14
14
|
test 'show first' do
|
15
15
|
step = :first
|
16
16
|
visit(bar_path(step))
|
17
|
-
|
17
|
+
assert_has_content?(step.to_s)
|
18
18
|
end
|
19
19
|
|
20
20
|
test 'show second' do
|
21
21
|
step = :second
|
22
22
|
visit(bar_path(step))
|
23
|
-
|
23
|
+
assert_has_content?(step.to_s)
|
24
24
|
end
|
25
25
|
|
26
26
|
test 'skip first' do
|
27
27
|
step = :first
|
28
28
|
visit(bar_path(step, :skip_step => 'true'))
|
29
|
-
|
29
|
+
assert_has_content?(:second.to_s)
|
30
30
|
end
|
31
31
|
|
32
32
|
test 'pointer to first' do
|
33
33
|
visit(bar_path(Wicked::FIRST_STEP))
|
34
|
-
|
34
|
+
assert_has_content?('first')
|
35
35
|
end
|
36
36
|
|
37
37
|
test 'pointer to last' do
|
38
38
|
visit(bar_path(Wicked::LAST_STEP))
|
39
|
-
|
39
|
+
assert_has_content?('last_step')
|
40
40
|
end
|
41
41
|
|
42
42
|
test 'invalid step' do
|
@@ -49,14 +49,14 @@ class IncludeNavigationTest < ActiveSupport::IntegrationCase
|
|
49
49
|
test 'finish' do
|
50
50
|
step = Wicked::FINISH_STEP
|
51
51
|
visit(bar_path(step))
|
52
|
-
|
52
|
+
assert_has_content?('home')
|
53
53
|
end
|
54
54
|
|
55
55
|
test 'finish with flash' do
|
56
56
|
step = Wicked::FINISH_STEP
|
57
57
|
visit bar_path(step, :notice => 'yo')
|
58
|
-
|
59
|
-
|
58
|
+
assert_has_content?('home')
|
59
|
+
assert_has_content?('notice:yo')
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -4,14 +4,14 @@ class NestedBuilderTest < ActiveSupport::IntegrationCase
|
|
4
4
|
|
5
5
|
test 'can use nested ids' do
|
6
6
|
visit nested_builder_path(:id => :last_step, :nested_id => "foo")
|
7
|
-
|
8
|
-
|
7
|
+
assert_has_content?("last")
|
8
|
+
assert_has_content?("params[:nested_id] foo")
|
9
9
|
end
|
10
10
|
|
11
11
|
test 'forwards nested ids' do
|
12
12
|
visit nested_builder_path(:id => :last_step, :nested_id => "foo")
|
13
|
-
|
13
|
+
assert_has_content?("last")
|
14
14
|
click_link 'next'
|
15
|
-
|
15
|
+
assert_has_content?("home")
|
16
16
|
end
|
17
17
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RedirectToFinishFlashTest < ActiveSupport::IntegrationCase
|
4
|
+
test 'redirect_to_next when in last step' do
|
5
|
+
step = :last_step
|
6
|
+
visit(redirect_to_finish_flash_path(step))
|
7
|
+
click_link 'Next'
|
8
|
+
assert has_content?('redirect_to_finish_flash/index')
|
9
|
+
assert has_content?('Flash message notice')
|
10
|
+
end
|
11
|
+
end
|
@@ -4,26 +4,26 @@ class RedirectToNextTest < ActiveSupport::IntegrationCase
|
|
4
4
|
test 'redirect_to_next without options' do
|
5
5
|
step = :first
|
6
6
|
visit(redirect_to_next_path(step, :jump_to => :last_step))
|
7
|
-
|
7
|
+
assert_has_content?('last_step')
|
8
8
|
end
|
9
9
|
|
10
10
|
test 'redirect_to_next with options' do
|
11
11
|
step = :first
|
12
12
|
visit(redirect_to_next_path(step, :jump_to => :last_step, :notice => 'jump notice'))
|
13
|
-
|
14
|
-
|
13
|
+
assert_has_content?('last_step')
|
14
|
+
assert_has_content?('notice:jump notice')
|
15
15
|
end
|
16
16
|
|
17
17
|
test 'redirect_to_finish_wizard without options' do
|
18
18
|
step = :first
|
19
19
|
visit(redirect_to_next_path(step, :jump_to => :finish_wizard))
|
20
|
-
|
20
|
+
assert_has_content?('home')
|
21
21
|
end
|
22
22
|
|
23
23
|
test 'redirect_to_finish_wizard with options' do
|
24
24
|
step = :first
|
25
25
|
visit(redirect_to_next_path(step, :jump_to => :finish_wizard, :notice => 'jump notice'))
|
26
|
-
|
27
|
-
|
26
|
+
assert_has_content?('home')
|
27
|
+
assert_has_content?('notice:jump notice')
|
28
28
|
end
|
29
29
|
end
|
@@ -5,31 +5,31 @@ class StepPositionsTest < ActiveSupport::IntegrationCase
|
|
5
5
|
test 'on first' do
|
6
6
|
step = :first
|
7
7
|
visit(step_position_path(step))
|
8
|
-
|
8
|
+
assert_has_content?('first step is the current step') # current_step?
|
9
9
|
assert true # past_step?
|
10
|
-
|
11
|
-
|
10
|
+
assert_has_content?('last_step step is a future step') # future_step?
|
11
|
+
assert_has_content?('second step is a future step') # future_step?
|
12
12
|
assert true # previous_step?
|
13
|
-
|
13
|
+
assert_has_content?('second step is the next step') # next_step?
|
14
14
|
end
|
15
15
|
|
16
16
|
test 'on second' do
|
17
17
|
step = :second
|
18
18
|
visit(step_position_path(step))
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
assert_has_content?('second step is the current step') # current_step?
|
20
|
+
assert_has_content?('first step is a past step') # past_step?
|
21
|
+
assert_has_content?('last_step step is a future step') # future_step?
|
22
|
+
assert_has_content?('first step was the previous step') # previous_step?
|
23
|
+
assert_has_content?('last_step step is the next step') # next_step?
|
24
24
|
end
|
25
25
|
|
26
26
|
test 'string-based steps' do
|
27
27
|
visit(string_step_path('second'))
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
assert_has_content?('second step is the current step') # current_step?
|
29
|
+
assert_has_content?('first step is a past step') # past_step?
|
30
|
+
assert_has_content?('last_step step is a future step') # future_step?
|
31
|
+
assert_has_content?('first step was the previous step') # previous_step?
|
32
|
+
assert_has_content?('last_step step is the next step') # next_step?
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
data/test/test_helper.rb
CHANGED
@@ -27,4 +27,10 @@ Capybara.default_selector = :css
|
|
27
27
|
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
28
28
|
|
29
29
|
# Load support files
|
30
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
30
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
31
|
+
|
32
|
+
class ActiveSupport::IntegrationCase
|
33
|
+
def assert_has_content?(content)
|
34
|
+
assert has_content?(content), "Expected #{page.body} to include #{content.inspect}"
|
35
|
+
end
|
36
|
+
end
|
data/wicked.gemspec
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: wicked 1.0.3 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "wicked"
|
8
|
-
s.version = "1.0.
|
9
|
+
s.version = "1.0.3"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["schneems"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2014-04-25"
|
13
15
|
s.description = "Wicked is a Rails engine for producing easy wizard controllers"
|
14
16
|
s.email = "richard.schneeman@gmail.com"
|
15
17
|
s.extra_rdoc_files = [
|
@@ -32,6 +34,7 @@ Gem::Specification.new do |s|
|
|
32
34
|
"lib/wicked/engine.rb",
|
33
35
|
"lib/wicked/wizard.rb",
|
34
36
|
"lib/wicked/wizard/translated.rb",
|
37
|
+
"test/controllers/bar_controller_test.rb",
|
35
38
|
"test/dummy/Rakefile",
|
36
39
|
"test/dummy/app/controllers/application_controller.rb",
|
37
40
|
"test/dummy/app/controllers/bar_controller.rb",
|
@@ -40,6 +43,7 @@ Gem::Specification.new do |s|
|
|
40
43
|
"test/dummy/app/controllers/jump_controller.rb",
|
41
44
|
"test/dummy/app/controllers/nested/builder_controller.rb",
|
42
45
|
"test/dummy/app/controllers/pages_controller.rb",
|
46
|
+
"test/dummy/app/controllers/redirect_to_finish_flash_controller.rb",
|
43
47
|
"test/dummy/app/controllers/redirect_to_next_controller.rb",
|
44
48
|
"test/dummy/app/controllers/steps_controller.rb",
|
45
49
|
"test/dummy/app/controllers/string_steps_controller.rb",
|
@@ -60,6 +64,8 @@ Gem::Specification.new do |s|
|
|
60
64
|
"test/dummy/app/views/nested/builder/last_step.html.erb",
|
61
65
|
"test/dummy/app/views/nested/builder/second.html.erb",
|
62
66
|
"test/dummy/app/views/pages/index.html.erb",
|
67
|
+
"test/dummy/app/views/redirect_to_finish_flash/index.html.erb",
|
68
|
+
"test/dummy/app/views/redirect_to_finish_flash/last_step.html.erb",
|
63
69
|
"test/dummy/app/views/redirect_to_next/first.html.erb",
|
64
70
|
"test/dummy/app/views/redirect_to_next/last_step.html.erb",
|
65
71
|
"test/dummy/app/views/redirect_to_next/second.html.erb",
|
@@ -102,6 +108,7 @@ Gem::Specification.new do |s|
|
|
102
108
|
"test/integration/jump_test.rb",
|
103
109
|
"test/integration/navigation_test.rb",
|
104
110
|
"test/integration/nested_builder_test.rb",
|
111
|
+
"test/integration/redirect_to_finish_flash_test.rb",
|
105
112
|
"test/integration/redirect_to_next_test.rb",
|
106
113
|
"test/integration/security_test.rb",
|
107
114
|
"test/integration/steps_test.rb",
|
@@ -112,12 +119,11 @@ Gem::Specification.new do |s|
|
|
112
119
|
]
|
113
120
|
s.homepage = "http://github.com/schneems/wicked"
|
114
121
|
s.licenses = ["MIT"]
|
115
|
-
s.
|
116
|
-
s.rubygems_version = "1.8.23"
|
122
|
+
s.rubygems_version = "2.2.2"
|
117
123
|
s.summary = "Use Wicked to turn your controller into a wizard"
|
118
124
|
|
119
125
|
if s.respond_to? :specification_version then
|
120
|
-
s.specification_version =
|
126
|
+
s.specification_version = 4
|
121
127
|
|
122
128
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
123
129
|
s.add_runtime_dependency(%q<rails>, [">= 3.0.7"])
|
metadata
CHANGED
@@ -1,126 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wicked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- schneems
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.0.7
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 3.0.7
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: jeweler
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: capybara
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- - ~>
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 1.1.2
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- - ~>
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 1.1.2
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: launchy
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: sqlite3
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ">="
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ">="
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: activerecord-jdbcsqlite3-adapter
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: 1.3.0.beta
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - ">="
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: 1.3.0.beta
|
126
111
|
description: Wicked is a Rails engine for producing easy wizard controllers
|
@@ -130,8 +115,8 @@ extensions: []
|
|
130
115
|
extra_rdoc_files:
|
131
116
|
- README.md
|
132
117
|
files:
|
133
|
-
- .rvmrc
|
134
|
-
- .travis.yml
|
118
|
+
- ".rvmrc"
|
119
|
+
- ".travis.yml"
|
135
120
|
- CHANGELOG.md
|
136
121
|
- Gemfile
|
137
122
|
- MIT-LICENSE
|
@@ -146,6 +131,7 @@ files:
|
|
146
131
|
- lib/wicked/engine.rb
|
147
132
|
- lib/wicked/wizard.rb
|
148
133
|
- lib/wicked/wizard/translated.rb
|
134
|
+
- test/controllers/bar_controller_test.rb
|
149
135
|
- test/dummy/Rakefile
|
150
136
|
- test/dummy/app/controllers/application_controller.rb
|
151
137
|
- test/dummy/app/controllers/bar_controller.rb
|
@@ -154,6 +140,7 @@ files:
|
|
154
140
|
- test/dummy/app/controllers/jump_controller.rb
|
155
141
|
- test/dummy/app/controllers/nested/builder_controller.rb
|
156
142
|
- test/dummy/app/controllers/pages_controller.rb
|
143
|
+
- test/dummy/app/controllers/redirect_to_finish_flash_controller.rb
|
157
144
|
- test/dummy/app/controllers/redirect_to_next_controller.rb
|
158
145
|
- test/dummy/app/controllers/steps_controller.rb
|
159
146
|
- test/dummy/app/controllers/string_steps_controller.rb
|
@@ -174,6 +161,8 @@ files:
|
|
174
161
|
- test/dummy/app/views/nested/builder/last_step.html.erb
|
175
162
|
- test/dummy/app/views/nested/builder/second.html.erb
|
176
163
|
- test/dummy/app/views/pages/index.html.erb
|
164
|
+
- test/dummy/app/views/redirect_to_finish_flash/index.html.erb
|
165
|
+
- test/dummy/app/views/redirect_to_finish_flash/last_step.html.erb
|
177
166
|
- test/dummy/app/views/redirect_to_next/first.html.erb
|
178
167
|
- test/dummy/app/views/redirect_to_next/last_step.html.erb
|
179
168
|
- test/dummy/app/views/redirect_to_next/second.html.erb
|
@@ -216,6 +205,7 @@ files:
|
|
216
205
|
- test/integration/jump_test.rb
|
217
206
|
- test/integration/navigation_test.rb
|
218
207
|
- test/integration/nested_builder_test.rb
|
208
|
+
- test/integration/redirect_to_finish_flash_test.rb
|
219
209
|
- test/integration/redirect_to_next_test.rb
|
220
210
|
- test/integration/security_test.rb
|
221
211
|
- test/integration/steps_test.rb
|
@@ -226,29 +216,25 @@ files:
|
|
226
216
|
homepage: http://github.com/schneems/wicked
|
227
217
|
licenses:
|
228
218
|
- MIT
|
219
|
+
metadata: {}
|
229
220
|
post_install_message:
|
230
221
|
rdoc_options: []
|
231
222
|
require_paths:
|
232
223
|
- lib
|
233
224
|
required_ruby_version: !ruby/object:Gem::Requirement
|
234
|
-
none: false
|
235
225
|
requirements:
|
236
|
-
- -
|
226
|
+
- - ">="
|
237
227
|
- !ruby/object:Gem::Version
|
238
228
|
version: '0'
|
239
|
-
segments:
|
240
|
-
- 0
|
241
|
-
hash: 3158381855714249075
|
242
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
|
-
none: false
|
244
230
|
requirements:
|
245
|
-
- -
|
231
|
+
- - ">="
|
246
232
|
- !ruby/object:Gem::Version
|
247
233
|
version: '0'
|
248
234
|
requirements: []
|
249
235
|
rubyforge_project:
|
250
|
-
rubygems_version:
|
236
|
+
rubygems_version: 2.2.2
|
251
237
|
signing_key:
|
252
|
-
specification_version:
|
238
|
+
specification_version: 4
|
253
239
|
summary: Use Wicked to turn your controller into a wizard
|
254
240
|
test_files: []
|