tournament 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +15 -0
- data/Manifest.txt +241 -2
- data/README.txt +152 -12
- data/Rakefile +9 -6
- data/bin/benchmark_pool +0 -0
- data/bin/gui.rb +3 -1
- data/bin/picker +0 -0
- data/bin/pool +139 -15
- data/lib/tournament/bracket.rb +33 -50
- data/lib/tournament/entry.rb +3 -0
- data/lib/tournament/pool.rb +144 -93
- data/lib/tournament/scoring_strategy.rb +69 -0
- data/lib/tournament/webgui_installer.rb +109 -0
- data/tasks/ann.rake +19 -14
- data/tasks/bones.rake +6 -25
- data/tasks/gem.rake +46 -36
- data/tasks/git.rake +41 -0
- data/tasks/jamis.rb +589 -0
- data/tasks/notes.rake +28 -0
- data/tasks/post_load.rake +18 -11
- data/tasks/{doc.rake → rdoc.rake} +12 -9
- data/tasks/rubyforge.rake +12 -12
- data/tasks/setup.rb +121 -80
- data/tasks/spec.rake +12 -13
- data/tasks/svn.rake +15 -11
- data/tasks/test.rake +6 -6
- data/test/test_tournament.rb +8 -0
- data/test/test_webgui_installer.rb +64 -0
- data/webgui/README +256 -0
- data/webgui/Rakefile +10 -0
- data/webgui/app/controllers/admin_controller.rb +61 -0
- data/webgui/app/controllers/application.rb +25 -0
- data/webgui/app/controllers/entry_controller.rb +97 -0
- data/webgui/app/controllers/pool_controller.rb +4 -0
- data/webgui/app/controllers/reports_controller.rb +7 -0
- data/webgui/app/controllers/sessions_controller.rb +43 -0
- data/webgui/app/controllers/teams_controller.rb +75 -0
- data/webgui/app/controllers/users_controller.rb +57 -0
- data/webgui/app/helpers/admin_helper.rb +2 -0
- data/webgui/app/helpers/application_helper.rb +3 -0
- data/webgui/app/helpers/entry_helper.rb +2 -0
- data/webgui/app/helpers/pool_helper.rb +2 -0
- data/webgui/app/helpers/reports_helper.rb +2 -0
- data/webgui/app/helpers/sessions_helper.rb +2 -0
- data/webgui/app/helpers/teams_helper.rb +2 -0
- data/webgui/app/helpers/users_helper.rb +93 -0
- data/webgui/app/models/entry.rb +42 -0
- data/webgui/app/models/pool.rb +141 -0
- data/webgui/app/models/region.rb +3 -0
- data/webgui/app/models/role.rb +4 -0
- data/webgui/app/models/seeding.rb +4 -0
- data/webgui/app/models/team.rb +6 -0
- data/webgui/app/models/user.rb +98 -0
- data/webgui/app/models/user_mailer.rb +25 -0
- data/webgui/app/views/admin/bracket.html.erb +3 -0
- data/webgui/app/views/admin/entries.html.erb +25 -0
- data/webgui/app/views/admin/index.html.erb +17 -0
- data/webgui/app/views/admin/pool.html.erb +53 -0
- data/webgui/app/views/entry/index.html.erb +16 -0
- data/webgui/app/views/entry/print.erb +1 -0
- data/webgui/app/views/entry/print.html.erb +1 -0
- data/webgui/app/views/entry/show.html.erb +1 -0
- data/webgui/app/views/layouts/bracket.html.erb +37 -0
- data/webgui/app/views/layouts/default.html.erb +62 -0
- data/webgui/app/views/layouts/print.html.erb +12 -0
- data/webgui/app/views/layouts/report.html.erb +38 -0
- data/webgui/app/views/pool/index.html.erb +36 -0
- data/webgui/app/views/reports/_report.html.erb +11 -0
- data/webgui/app/views/reports/show.html.erb +12 -0
- data/webgui/app/views/sessions/new.html.erb +21 -0
- data/webgui/app/views/shared/_admins.html.erb +8 -0
- data/webgui/app/views/shared/_bracket.html.erb +1296 -0
- data/webgui/app/views/teams/choose.html.erb +57 -0
- data/webgui/app/views/user_mailer/activation.erb +3 -0
- data/webgui/app/views/user_mailer/signup_notification.erb +8 -0
- data/webgui/app/views/users/_user_bar.html.erb +8 -0
- data/webgui/app/views/users/new.html.erb +19 -0
- data/webgui/config/boot.rb +109 -0
- data/webgui/config/database.yml +22 -0
- data/webgui/config/environment.rb +78 -0
- data/webgui/config/environments/development.rb +29 -0
- data/webgui/config/environments/production.rb +24 -0
- data/webgui/config/environments/test.rb +22 -0
- data/webgui/config/initializers/inflections.rb +10 -0
- data/webgui/config/initializers/mime_types.rb +5 -0
- data/webgui/config/initializers/new_rails_defaults.rb +17 -0
- data/webgui/config/initializers/pool.rb +33 -0
- data/webgui/config/initializers/site_keys.rb +38 -0
- data/webgui/config/locales/en.yml +5 -0
- data/webgui/config/routes.rb +56 -0
- data/webgui/db/development.sqlite3 +0 -0
- data/webgui/db/migrate/20090216015836_create_entries.rb +13 -0
- data/webgui/db/migrate/20090217001611_add_tie_break_to_entry.rb +9 -0
- data/webgui/db/migrate/20090217004039_create_users.rb +23 -0
- data/webgui/db/migrate/20090217014940_relate_entry_and_user.rb +10 -0
- data/webgui/db/migrate/20090218024350_create_roles.rb +17 -0
- data/webgui/db/migrate/20090218024657_add_postition_to_roles.rb +9 -0
- data/webgui/db/migrate/20090218025240_add_admin_role.rb +10 -0
- data/webgui/db/migrate/20090225022928_create_pools.rb +16 -0
- data/webgui/db/migrate/20090225030346_associate_pool_and_entry.rb +9 -0
- data/webgui/db/migrate/20090225072358_change_pool_data_column.rb +9 -0
- data/webgui/db/migrate/20090225072849_add_completed_to_entries.rb +9 -0
- data/webgui/db/migrate/20090225074149_add_pool_id_index_to_entries.rb +9 -0
- data/webgui/db/migrate/20090225084414_add_user_id_to_pool.rb +9 -0
- data/webgui/db/migrate/20090226021913_add_active_to_pools.rb +9 -0
- data/webgui/db/migrate/20090226142240_rename_bracket_column_to_data.rb +9 -0
- data/webgui/db/migrate/20090301014710_create_teams.rb +84 -0
- data/webgui/db/migrate/20090301025902_add_more_teams.rb +16 -0
- data/webgui/db/migrate/20090301041526_create_seedings.rb +16 -0
- data/webgui/db/migrate/20090301090511_create_regions.rb +14 -0
- data/webgui/db/migrate/teams.txt +347 -0
- data/webgui/db/pool.yml +408 -0
- data/webgui/db/schema.rb +91 -0
- data/webgui/db/test.sqlite3 +0 -0
- data/webgui/doc/README_FOR_APP +5 -0
- data/webgui/lib/authenticated_system.rb +189 -0
- data/webgui/lib/authenticated_test_helper.rb +11 -0
- data/webgui/lib/form_object.rb +70 -0
- data/webgui/lib/pdf_helper.rb +47 -0
- data/webgui/lib/prince.rb +74 -0
- data/webgui/lib/saves_picks.rb +23 -0
- data/webgui/lib/tasks/admin.rake +10 -0
- data/webgui/public/404.html +30 -0
- data/webgui/public/422.html +30 -0
- data/webgui/public/500.html +33 -0
- data/webgui/public/dispatch.cgi +10 -0
- data/webgui/public/dispatch.fcgi +24 -0
- data/webgui/public/dispatch.rb +10 -0
- data/webgui/public/favicon.ico +0 -0
- data/webgui/public/images/2009FinalFour.png +0 -0
- data/webgui/public/images/rails.png +0 -0
- data/webgui/public/javascripts/application.js +2 -0
- data/webgui/public/javascripts/bracket.js +73 -0
- data/webgui/public/javascripts/controls.js +963 -0
- data/webgui/public/javascripts/dragdrop.js +973 -0
- data/webgui/public/javascripts/effects.js +1128 -0
- data/webgui/public/javascripts/prototype.js +4320 -0
- data/webgui/public/robots.txt +5 -0
- data/webgui/public/stylesheets/bracket-print.css +39 -0
- data/webgui/public/stylesheets/bracket.css +125 -0
- data/webgui/public/stylesheets/main.css +144 -0
- data/webgui/public/stylesheets/prince.css +6 -0
- data/webgui/public/stylesheets/prince_landscape.css +1 -0
- data/webgui/script/about +4 -0
- data/webgui/script/console +3 -0
- data/webgui/script/dbconsole +3 -0
- data/webgui/script/destroy +3 -0
- data/webgui/script/generate +3 -0
- data/webgui/script/performance/benchmarker +3 -0
- data/webgui/script/performance/profiler +3 -0
- data/webgui/script/performance/request +3 -0
- data/webgui/script/plugin +3 -0
- data/webgui/script/process/inspector +3 -0
- data/webgui/script/process/reaper +3 -0
- data/webgui/script/process/spawner +3 -0
- data/webgui/script/runner +3 -0
- data/webgui/script/server +3 -0
- data/webgui/test/fixtures/entries.yml +10 -0
- data/webgui/test/fixtures/pools.yml +14 -0
- data/webgui/test/fixtures/regions.yml +11 -0
- data/webgui/test/fixtures/roles.yml +11 -0
- data/webgui/test/fixtures/roles_users.yml +3 -0
- data/webgui/test/fixtures/seedings.yml +12 -0
- data/webgui/test/fixtures/teams.yml +3051 -0
- data/webgui/test/fixtures/users.yml +44 -0
- data/webgui/test/functional/admin_controller_test.rb +8 -0
- data/webgui/test/functional/entry_controller_test.rb +27 -0
- data/webgui/test/functional/pool_controller_test.rb +8 -0
- data/webgui/test/functional/reports_controller_test.rb +8 -0
- data/webgui/test/functional/sessions_controller_test.rb +82 -0
- data/webgui/test/functional/teams_controller_test.rb +216 -0
- data/webgui/test/functional/users_controller_test.rb +88 -0
- data/webgui/test/performance/browsing_test.rb +9 -0
- data/webgui/test/test_helper.rb +38 -0
- data/webgui/test/unit/entry_test.rb +8 -0
- data/webgui/test/unit/pool_test.rb +8 -0
- data/webgui/test/unit/region_test.rb +8 -0
- data/webgui/test/unit/role_test.rb +8 -0
- data/webgui/test/unit/seeding_test.rb +8 -0
- data/webgui/test/unit/team_test.rb +10 -0
- data/webgui/test/unit/user_mailer_test.rb +31 -0
- data/webgui/test/unit/user_test.rb +109 -0
- data/webgui/vendor/plugins/auto_complete/README +23 -0
- data/webgui/vendor/plugins/auto_complete/Rakefile +22 -0
- data/webgui/vendor/plugins/auto_complete/init.rb +2 -0
- data/webgui/vendor/plugins/auto_complete/lib/auto_complete.rb +47 -0
- data/webgui/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb +143 -0
- data/webgui/vendor/plugins/auto_complete/test/auto_complete_test.rb +67 -0
- data/webgui/vendor/plugins/enumerations_mixin/ATTENTION +15 -0
- data/webgui/vendor/plugins/enumerations_mixin/LICENSE +20 -0
- data/webgui/vendor/plugins/enumerations_mixin/README_ENUMERATIONS +163 -0
- data/webgui/vendor/plugins/enumerations_mixin/init.rb +21 -0
- data/webgui/vendor/plugins/enumerations_mixin/lib/active_record/acts/enumerated.rb +177 -0
- data/webgui/vendor/plugins/enumerations_mixin/lib/active_record/aggregations/has_enumerated.rb +60 -0
- data/webgui/vendor/plugins/enumerations_mixin/lib/active_record/virtual_enumerations.rb +68 -0
- data/webgui/vendor/plugins/enumerations_mixin/virtual_enumerations_sample.rb +76 -0
- data/webgui/vendor/plugins/restful_authentication/.gitignore +21 -0
- data/webgui/vendor/plugins/restful_authentication/CHANGELOG +68 -0
- data/webgui/vendor/plugins/restful_authentication/README.textile +224 -0
- data/webgui/vendor/plugins/restful_authentication/Rakefile +32 -0
- data/webgui/vendor/plugins/restful_authentication/TODO +15 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/USAGE +1 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/authenticated_generator.rb +478 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/lib/insert_routes.rb +54 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/_model_partial.html.erb +8 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/activation.erb +3 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/authenticated_system.rb +189 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/authenticated_test_helper.rb +22 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/controller.rb +43 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/helper.rb +2 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/login.html.erb +16 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/mailer.rb +25 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/migration.rb +26 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/model.rb +83 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/model_controller.rb +85 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/model_helper.rb +93 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/model_helper_spec.rb +158 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/observer.rb +11 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/signup.html.erb +19 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/signup_notification.erb +8 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/site_keys.rb +38 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/controllers/access_control_spec.rb +90 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/controllers/authenticated_system_spec.rb +102 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/controllers/sessions_controller_spec.rb +139 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/controllers/users_controller_spec.rb +198 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/fixtures/users.yml +60 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/helpers/users_helper_spec.rb +141 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/models/user_spec.rb +290 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/rest_auth_stories.rb +22 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/rest_auth_stories_helper.rb +81 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/steps/ra_navigation_steps.rb +49 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/steps/ra_resource_steps.rb +179 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/steps/ra_response_steps.rb +171 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/steps/user_steps.rb +153 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/users/accounts.story +186 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/users/sessions.story +134 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/test/functional_test.rb +82 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/test/mailer_test.rb +31 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/test/model_functional_test.rb +93 -0
- data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/test/unit_test.rb +164 -0
- data/webgui/vendor/plugins/restful_authentication/init.rb +1 -0
- data/webgui/vendor/plugins/restful_authentication/install.rb +1 -0
- data/webgui/vendor/plugins/restful_authentication/lib/authentication/by_cookie_token.rb +82 -0
- data/webgui/vendor/plugins/restful_authentication/lib/authentication/by_password.rb +64 -0
- data/webgui/vendor/plugins/restful_authentication/lib/authentication.rb +40 -0
- data/webgui/vendor/plugins/restful_authentication/lib/authorization/aasm_roles.rb +63 -0
- data/webgui/vendor/plugins/restful_authentication/lib/authorization/stateful_roles.rb +62 -0
- data/webgui/vendor/plugins/restful_authentication/lib/authorization.rb +14 -0
- data/webgui/vendor/plugins/restful_authentication/lib/trustification/email_validation.rb +20 -0
- data/webgui/vendor/plugins/restful_authentication/lib/trustification.rb +14 -0
- data/webgui/vendor/plugins/restful_authentication/notes/AccessControl.txt +2 -0
- data/webgui/vendor/plugins/restful_authentication/notes/Authentication.txt +5 -0
- data/webgui/vendor/plugins/restful_authentication/notes/Authorization.txt +154 -0
- data/webgui/vendor/plugins/restful_authentication/notes/RailsPlugins.txt +78 -0
- data/webgui/vendor/plugins/restful_authentication/notes/SecurityFramework.graffle +0 -0
- data/webgui/vendor/plugins/restful_authentication/notes/SecurityFramework.png +0 -0
- data/webgui/vendor/plugins/restful_authentication/notes/SecurityPatterns.txt +163 -0
- data/webgui/vendor/plugins/restful_authentication/notes/Tradeoffs.txt +126 -0
- data/webgui/vendor/plugins/restful_authentication/notes/Trustification.txt +49 -0
- data/webgui/vendor/plugins/restful_authentication/rails/init.rb +3 -0
- data/webgui/vendor/plugins/restful_authentication/restful-authentication.gemspec +33 -0
- data/webgui/vendor/plugins/restful_authentication/tasks/auth.rake +33 -0
- metadata +288 -8
- data/tasks/annotations.rake +0 -22
@@ -0,0 +1,171 @@
|
|
1
|
+
#
|
2
|
+
# What you should see when you get there
|
3
|
+
#
|
4
|
+
|
5
|
+
steps_for(:ra_response) do
|
6
|
+
#
|
7
|
+
# Destinations. Ex:
|
8
|
+
# She should be at the new kids page
|
9
|
+
# Tarkin should be at the destroy alderaan page
|
10
|
+
# The visitor should be at the '/lolcats/download' form
|
11
|
+
# The visitor should be redirected to '/hi/mom'
|
12
|
+
#
|
13
|
+
# It doesn't know anything about actual routes -- it just
|
14
|
+
# feeds its output to render_template or redirect_to
|
15
|
+
#
|
16
|
+
Then "$actor should be at $path" do |_, path|
|
17
|
+
response.should render_template(grok_path(path))
|
18
|
+
end
|
19
|
+
|
20
|
+
Then "$actor should be redirected to $path" do |_, path|
|
21
|
+
response.should redirect_to(grok_path(path))
|
22
|
+
end
|
23
|
+
|
24
|
+
Then "the page should look AWESOME" do
|
25
|
+
response.should have_tag('head>title')
|
26
|
+
response.should have_tag('h1')
|
27
|
+
# response.should be_valid_xhtml
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Tags
|
32
|
+
#
|
33
|
+
|
34
|
+
Then "the page should contain '$text'" do |_, text|
|
35
|
+
response.should have_text(/#{text}/)
|
36
|
+
end
|
37
|
+
|
38
|
+
# please note: this enforces the use of a <label> field
|
39
|
+
Then "$actor should see a <$container> containing a $attributes" do |_, container, attributes|
|
40
|
+
attributes = attributes.to_hash_from_story
|
41
|
+
response.should have_tag(container) do
|
42
|
+
attributes.each do |tag, label|
|
43
|
+
case tag
|
44
|
+
when "textfield" then with_tag "input[type='text']"; with_tag("label", label)
|
45
|
+
when "password" then with_tag "input[type='password']"; with_tag("label", label)
|
46
|
+
when "submit" then with_tag "input[type='submit'][value='#{label}']"
|
47
|
+
else with_tag tag, label
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# Session, cookie variables
|
55
|
+
#
|
56
|
+
Then "$actor $token cookie should include $attrlist" do |_, token, attrlist|
|
57
|
+
attrlist = attrlist.to_array_from_story
|
58
|
+
cookies.include?(token).should be_true
|
59
|
+
attrlist.each do |val|
|
60
|
+
cookies[token].include?(val).should be_true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
Then "$actor $token cookie should exist but not include $attrlist" do |_, token, attrlist|
|
65
|
+
attrlist = attrlist.to_array_from_story
|
66
|
+
cookies.include?(token).should be_true
|
67
|
+
puts [cookies, attrlist, token].to_yaml
|
68
|
+
attrlist.each do |val|
|
69
|
+
cookies[token].include?(val).should_not be_true
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
Then "$actor should have $an $token cookie" do |_, _, token|
|
74
|
+
cookies[token].should_not be_blank
|
75
|
+
end
|
76
|
+
Then "$actor should not have $an $token cookie" do |_, _, token|
|
77
|
+
cookies[token].should be_blank
|
78
|
+
end
|
79
|
+
|
80
|
+
Given "$actor has $an cookie jar with $attributes" do |_, _, attributes|
|
81
|
+
attributes = attributes.to_hash_from_story
|
82
|
+
attributes.each do |attr, val|
|
83
|
+
cookies[attr] = val
|
84
|
+
end
|
85
|
+
end
|
86
|
+
Given "$actor session store has no $attrlist" do |_, attrlist|
|
87
|
+
attrlist = attrlist.to_array_from_story
|
88
|
+
attrlist.each do |attr|
|
89
|
+
# Note that the comparison passes through 'to_s'
|
90
|
+
session[attr.to_sym] = nil
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
Then "$actor session store should have $attributes" do |_, attributes|
|
95
|
+
attributes = attributes.to_hash_from_story
|
96
|
+
attributes.each do |attr, val|
|
97
|
+
# Note that the comparison passes through 'to_s'
|
98
|
+
session[attr.to_sym].to_s.should eql(val)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
Then "$actor session store should not have $attrlist" do |_, attrlist|
|
103
|
+
attrlist = attrlist.to_array_from_story
|
104
|
+
attrlist.each do |attr|
|
105
|
+
session[attr.to_sym].blank?.should be_true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
#
|
110
|
+
# Flash messages
|
111
|
+
#
|
112
|
+
|
113
|
+
Then "$actor should see $an $notice message '$message'" do |_, _, notice, message|
|
114
|
+
response.should have_flash(notice, %r{#{message}})
|
115
|
+
end
|
116
|
+
|
117
|
+
Then "$actor should not see $an $notice message '$message'" do |_, _, notice, message|
|
118
|
+
response.should_not have_flash(notice, %r{#{message}})
|
119
|
+
end
|
120
|
+
|
121
|
+
Then "$actor should see no messages" do |_|
|
122
|
+
['error', 'warning', 'notice'].each do |notice|
|
123
|
+
response.should_not have_flash(notice)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
RE_POLITENESS = /(?:please|sorry|thank(?:s| you))/i
|
128
|
+
Then %r{we should be polite about it} do
|
129
|
+
response.should have_tag("div.error,div.notice", RE_POLITENESS)
|
130
|
+
end
|
131
|
+
Then %r{we should not even be polite about it} do
|
132
|
+
response.should_not have_tag("div.error,div.notice", RE_POLITENESS)
|
133
|
+
end
|
134
|
+
|
135
|
+
#
|
136
|
+
# Resource's attributes
|
137
|
+
#
|
138
|
+
# "Then page should have the $resource's $attributes" is in resource_steps
|
139
|
+
|
140
|
+
# helpful debug step
|
141
|
+
Then "we dump the response" do
|
142
|
+
dump_response
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
def have_flash notice, *args
|
148
|
+
have_tag("div.#{notice}", *args)
|
149
|
+
end
|
150
|
+
|
151
|
+
RE_PRETTY_RESOURCE = /the (index|show|new|create|edit|update|destroy) (\w+) (page|form)/i
|
152
|
+
RE_THE_FOO_PAGE = /the '?([^']*)'? (page|form)/i
|
153
|
+
RE_QUOTED_PATH = /^'([^']*)'$/i
|
154
|
+
def grok_path path
|
155
|
+
path.gsub(/\s+again$/,'') # strip trailing ' again'
|
156
|
+
case
|
157
|
+
when path == 'the home page' then dest = '/'
|
158
|
+
when path =~ RE_PRETTY_RESOURCE then dest = template_for $1, $2
|
159
|
+
when path =~ RE_THE_FOO_PAGE then dest = $1
|
160
|
+
when path =~ RE_QUOTED_PATH then dest = $1
|
161
|
+
else dest = path
|
162
|
+
end
|
163
|
+
dest
|
164
|
+
end
|
165
|
+
|
166
|
+
# turns 'new', 'road bikes' into 'road_bikes/new'
|
167
|
+
# note that it's "action resource"
|
168
|
+
def template_for(action, resource)
|
169
|
+
"#{resource.gsub(" ","_")}/#{action}"
|
170
|
+
end
|
171
|
+
|
@@ -0,0 +1,153 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../helper'
|
2
|
+
|
3
|
+
RE_<%= file_name.capitalize %> = %r{(?:(?:the )? *(\w+) *)}
|
4
|
+
RE_<%= file_name.capitalize %>_TYPE = %r{(?: *(\w+)? *)}
|
5
|
+
steps_for(:<%= file_name %>) do
|
6
|
+
|
7
|
+
#
|
8
|
+
# Setting
|
9
|
+
#
|
10
|
+
|
11
|
+
Given "an anonymous <%= file_name %>" do
|
12
|
+
log_out!
|
13
|
+
end
|
14
|
+
|
15
|
+
Given "$an $<%= file_name %>_type <%= file_name %> with $attributes" do |_, <%= file_name %>_type, attributes|
|
16
|
+
create_<%= file_name %>! <%= file_name %>_type, attributes.to_hash_from_story
|
17
|
+
end
|
18
|
+
|
19
|
+
Given "$an $<%= file_name %>_type <%= file_name %> named '$login'" do |_, <%= file_name %>_type, login|
|
20
|
+
create_<%= file_name %>! <%= file_name %>_type, named_<%= file_name %>(login)
|
21
|
+
end
|
22
|
+
|
23
|
+
Given "$an $<%= file_name %>_type <%= file_name %> logged in as '$login'" do |_, <%= file_name %>_type, login|
|
24
|
+
create_<%= file_name %>! <%= file_name %>_type, named_<%= file_name %>(login)
|
25
|
+
log_in_<%= file_name %>!
|
26
|
+
end
|
27
|
+
|
28
|
+
Given "$actor is logged in" do |_, login|
|
29
|
+
log_in_<%= file_name %>! @<%= file_name %>_params || named_<%= file_name %>(login)
|
30
|
+
end
|
31
|
+
|
32
|
+
Given "there is no $<%= file_name %>_type <%= file_name %> named '$login'" do |_, login|
|
33
|
+
@<%= file_name %> = <%= class_name %>.find_by_login(login)
|
34
|
+
@<%= file_name %>.destroy! if @<%= file_name %>
|
35
|
+
@<%= file_name %>.should be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Actions
|
40
|
+
#
|
41
|
+
When "$actor logs out" do
|
42
|
+
log_out
|
43
|
+
end
|
44
|
+
|
45
|
+
When "$actor registers an account as the preloaded '$login'" do |_, login|
|
46
|
+
<%= file_name %> = named_<%= file_name %>(login)
|
47
|
+
<%= file_name %>['password_confirmation'] = <%= file_name %>['password']
|
48
|
+
create_<%= file_name %> <%= file_name %>
|
49
|
+
end
|
50
|
+
|
51
|
+
When "$actor registers an account with $attributes" do |_, attributes|
|
52
|
+
create_<%= file_name %> attributes.to_hash_from_story
|
53
|
+
end
|
54
|
+
<% if options[:include_activation] %>
|
55
|
+
When "$actor activates with activation code $attributes" do |_, activation_code|
|
56
|
+
activation_code = '' if activation_code == 'that is blank'
|
57
|
+
activate
|
58
|
+
end<% end %>
|
59
|
+
|
60
|
+
When "$actor logs in with $attributes" do |_, attributes|
|
61
|
+
log_in_<%= file_name %> attributes.to_hash_from_story
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# Result
|
66
|
+
#
|
67
|
+
Then "$actor should be invited to sign in" do |_|
|
68
|
+
response.should render_template('/<%= controller_file_path %>/new')
|
69
|
+
end
|
70
|
+
|
71
|
+
Then "$actor should not be logged in" do |_|
|
72
|
+
controller.logged_in?.should_not be_true
|
73
|
+
end
|
74
|
+
|
75
|
+
Then "$login should be logged in" do |login|
|
76
|
+
controller.logged_in?.should be_true
|
77
|
+
controller.current_<%= file_name %>.should === @<%= file_name %>
|
78
|
+
controller.current_<%= file_name %>.login.should == login
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
def named_<%= file_name %> login
|
84
|
+
<%= file_name %>_params = {
|
85
|
+
'admin' => {'id' => 1, 'login' => 'addie', 'password' => '1234addie', 'email' => 'admin@example.com', },
|
86
|
+
'oona' => { 'login' => 'oona', 'password' => '1234oona', 'email' => 'unactivated@example.com'},
|
87
|
+
'reggie' => { 'login' => 'reggie', 'password' => 'monkey', 'email' => 'registered@example.com' },
|
88
|
+
}
|
89
|
+
<%= file_name %>_params[login.downcase]
|
90
|
+
end
|
91
|
+
|
92
|
+
#
|
93
|
+
# <%= class_name %> account actions.
|
94
|
+
#
|
95
|
+
# The ! methods are 'just get the job done'. It's true, they do some testing of
|
96
|
+
# their own -- thus un-DRY'ing tests that do and should live in the <%= file_name %> account
|
97
|
+
# stories -- but the repetition is ultimately important so that a faulty test setup
|
98
|
+
# fails early.
|
99
|
+
#
|
100
|
+
|
101
|
+
def log_out
|
102
|
+
get '/<%= controller_file_path %>/destroy'
|
103
|
+
end
|
104
|
+
|
105
|
+
def log_out!
|
106
|
+
log_out
|
107
|
+
response.should redirect_to('/')
|
108
|
+
follow_redirect!
|
109
|
+
end
|
110
|
+
|
111
|
+
def create_<%= file_name %>(<%= file_name %>_params={})
|
112
|
+
@<%= file_name %>_params ||= <%= file_name %>_params
|
113
|
+
post "/<%= model_controller_file_path %>", :<%= file_name %> => <%= file_name %>_params
|
114
|
+
@<%= file_name %> = <%= class_name %>.find_by_login(<%= file_name %>_params['login'])
|
115
|
+
end
|
116
|
+
|
117
|
+
def create_<%= file_name %>!(<%= file_name %>_type, <%= file_name %>_params)
|
118
|
+
<%= file_name %>_params['password_confirmation'] ||= <%= file_name %>_params['password'] ||= <%= file_name %>_params['password']
|
119
|
+
create_<%= file_name %> <%= file_name %>_params
|
120
|
+
response.should redirect_to('/')
|
121
|
+
follow_redirect!
|
122
|
+
<% if options[:include_activation] %>
|
123
|
+
# fix the <%= file_name %>'s activation status
|
124
|
+
activate_<%= file_name %>! if <%= file_name %>_type == 'activated'<% end %>
|
125
|
+
end
|
126
|
+
|
127
|
+
<% if options[:include_activation] %>
|
128
|
+
def activate_<%= file_name %> activation_code=nil
|
129
|
+
activation_code = @<%= file_name %>.activation_code if activation_code.nil?
|
130
|
+
get "/activate/#{activation_code}"
|
131
|
+
end
|
132
|
+
|
133
|
+
def activate_<%= file_name %>! *args
|
134
|
+
activate_<%= file_name %> *args
|
135
|
+
response.should redirect_to('/login')
|
136
|
+
follow_redirect!
|
137
|
+
response.should have_flash("notice", /Signup complete!/)
|
138
|
+
end<% end %>
|
139
|
+
|
140
|
+
def log_in_<%= file_name %> <%= file_name %>_params=nil
|
141
|
+
@<%= file_name %>_params ||= <%= file_name %>_params
|
142
|
+
<%= file_name %>_params ||= @<%= file_name %>_params
|
143
|
+
post "/<%= controller_routing_path %>", <%= file_name %>_params
|
144
|
+
@<%= file_name %> = <%= class_name %>.find_by_login(<%= file_name %>_params['login'])
|
145
|
+
controller.current_<%= file_name %>
|
146
|
+
end
|
147
|
+
|
148
|
+
def log_in_<%= file_name %>! *args
|
149
|
+
log_in_<%= file_name %> *args
|
150
|
+
response.should redirect_to('/')
|
151
|
+
follow_redirect!
|
152
|
+
response.should have_flash("notice", /Logged in successfully/)
|
153
|
+
end
|
@@ -0,0 +1,186 @@
|
|
1
|
+
Visitors should be in control of creating an account and of proving their
|
2
|
+
essential humanity/accountability or whatever it is people think the
|
3
|
+
id-validation does. We should be fairly skeptical about this process, as the
|
4
|
+
identity+trust chain starts here.
|
5
|
+
|
6
|
+
Story: Creating an account
|
7
|
+
As an anonymous <%= file_name %>
|
8
|
+
I want to be able to create an account
|
9
|
+
So that I can be one of the cool kids
|
10
|
+
|
11
|
+
#
|
12
|
+
# Account Creation: Get entry form
|
13
|
+
#
|
14
|
+
Scenario: Anonymous <%= file_name %> can start creating an account
|
15
|
+
Given an anonymous <%= file_name %>
|
16
|
+
When she goes to /signup
|
17
|
+
Then she should be at the '<%= model_controller_routing_path %>/new' page
|
18
|
+
And the page should look AWESOME
|
19
|
+
And she should see a <form> containing a textfield: Login, textfield: Email, password: Password, password: 'Confirm Password', submit: 'Sign up'
|
20
|
+
|
21
|
+
#
|
22
|
+
# Account Creation
|
23
|
+
#
|
24
|
+
Scenario: Anonymous <%= file_name %> can create an account
|
25
|
+
Given an anonymous <%= file_name %>
|
26
|
+
And no <%= file_name %> with login: 'Oona' exists
|
27
|
+
When she registers an account as the preloaded 'Oona'
|
28
|
+
Then she should be redirected to the home page
|
29
|
+
When she follows that redirect!
|
30
|
+
Then she should see a notice message 'Thanks for signing up!'
|
31
|
+
And a <%= file_name %> with login: 'oona' should exist
|
32
|
+
And the <%= file_name %> should have login: 'oona', and email: 'unactivated@example.com'
|
33
|
+
<% if options[:include_activation] %>
|
34
|
+
And the <%= file_name %>'s activation_code should not be nil
|
35
|
+
And the <%= file_name %>'s activated_at should be nil
|
36
|
+
And she should not be logged in
|
37
|
+
<% else %>
|
38
|
+
And oona should be logged in
|
39
|
+
<% end %>
|
40
|
+
|
41
|
+
#
|
42
|
+
# Account Creation Failure: Account exists
|
43
|
+
#
|
44
|
+
<% if options[:include_activation] %>
|
45
|
+
Scenario: Anonymous <%= file_name %> can not create an account replacing a non-activated account
|
46
|
+
Given an anonymous <%= file_name %>
|
47
|
+
And a registered <%= file_name %> named 'Reggie'
|
48
|
+
And the <%= file_name %> has activation_code: 'activate_me', activated_at: nil!
|
49
|
+
And we try hard to remember the <%= file_name %>'s updated_at, and created_at
|
50
|
+
When she registers an account with login: 'reggie', password: 'monkey', and email: 'different@example.com'
|
51
|
+
Then she should be at the '<%= model_controller_routing_path %>/new' page
|
52
|
+
And she should see an errorExplanation message 'Login has already been taken'
|
53
|
+
And she should not see an errorExplanation message 'Email has already been taken'
|
54
|
+
And a <%= file_name %> with login: 'reggie' should exist
|
55
|
+
And the <%= file_name %> should have email: 'registered@example.com'
|
56
|
+
And the <%= file_name %>'s activation_code should not be nil
|
57
|
+
And the <%= file_name %>'s activated_at should be nil
|
58
|
+
And the <%= file_name %>'s created_at should stay the same under to_s
|
59
|
+
And the <%= file_name %>'s updated_at should stay the same under to_s
|
60
|
+
And she should not be logged in<% end %>
|
61
|
+
|
62
|
+
Scenario: Anonymous <%= file_name %> can not create an account replacing an activated account
|
63
|
+
Given an anonymous <%= file_name %>
|
64
|
+
And an activated <%= file_name %> named 'Reggie'
|
65
|
+
And we try hard to remember the <%= file_name %>'s updated_at, and created_at
|
66
|
+
When she registers an account with login: 'reggie', password: 'monkey', and email: 'reggie@example.com'
|
67
|
+
Then she should be at the '<%= model_controller_routing_path %>/new' page
|
68
|
+
And she should see an errorExplanation message 'Login has already been taken'
|
69
|
+
And she should not see an errorExplanation message 'Email has already been taken'
|
70
|
+
And a <%= file_name %> with login: 'reggie' should exist
|
71
|
+
And the <%= file_name %> should have email: 'registered@example.com'
|
72
|
+
<% if options[:include_activation] %>
|
73
|
+
And the <%= file_name %>'s activation_code should be nil
|
74
|
+
And the <%= file_name %>'s activated_at should not be nil<% end %>
|
75
|
+
And the <%= file_name %>'s created_at should stay the same under to_s
|
76
|
+
And the <%= file_name %>'s updated_at should stay the same under to_s
|
77
|
+
And she should not be logged in
|
78
|
+
|
79
|
+
#
|
80
|
+
# Account Creation Failure: Incomplete input
|
81
|
+
#
|
82
|
+
Scenario: Anonymous <%= file_name %> can not create an account with incomplete or incorrect input
|
83
|
+
Given an anonymous <%= file_name %>
|
84
|
+
And no <%= file_name %> with login: 'Oona' exists
|
85
|
+
When she registers an account with login: '', password: 'monkey', password_confirmation: 'monkey' and email: 'unactivated@example.com'
|
86
|
+
Then she should be at the '<%= model_controller_routing_path %>/new' page
|
87
|
+
And she should see an errorExplanation message 'Login can't be blank'
|
88
|
+
And no <%= file_name %> with login: 'oona' should exist
|
89
|
+
|
90
|
+
Scenario: Anonymous <%= file_name %> can not create an account with no password
|
91
|
+
Given an anonymous <%= file_name %>
|
92
|
+
And no <%= file_name %> with login: 'Oona' exists
|
93
|
+
When she registers an account with login: 'oona', password: '', password_confirmation: 'monkey' and email: 'unactivated@example.com'
|
94
|
+
Then she should be at the '<%= model_controller_routing_path %>/new' page
|
95
|
+
And she should see an errorExplanation message 'Password can't be blank'
|
96
|
+
And no <%= file_name %> with login: 'oona' should exist
|
97
|
+
|
98
|
+
Scenario: Anonymous <%= file_name %> can not create an account with no password_confirmation
|
99
|
+
Given an anonymous <%= file_name %>
|
100
|
+
And no <%= file_name %> with login: 'Oona' exists
|
101
|
+
When she registers an account with login: 'oona', password: 'monkey', password_confirmation: '' and email: 'unactivated@example.com'
|
102
|
+
Then she should be at the '<%= model_controller_routing_path %>/new' page
|
103
|
+
And she should see an errorExplanation message 'Password confirmation can't be blank'
|
104
|
+
And no <%= file_name %> with login: 'oona' should exist
|
105
|
+
|
106
|
+
Scenario: Anonymous <%= file_name %> can not create an account with mismatched password & password_confirmation
|
107
|
+
Given an anonymous <%= file_name %>
|
108
|
+
And no <%= file_name %> with login: 'Oona' exists
|
109
|
+
When she registers an account with login: 'oona', password: 'monkey', password_confirmation: 'monkeY' and email: 'unactivated@example.com'
|
110
|
+
Then she should be at the '<%= model_controller_routing_path %>/new' page
|
111
|
+
And she should see an errorExplanation message 'Password doesn't match confirmation'
|
112
|
+
And no <%= file_name %> with login: 'oona' should exist
|
113
|
+
|
114
|
+
Scenario: Anonymous <%= file_name %> can not create an account with bad email
|
115
|
+
Given an anonymous <%= file_name %>
|
116
|
+
And no <%= file_name %> with login: 'Oona' exists
|
117
|
+
When she registers an account with login: 'oona', password: 'monkey', password_confirmation: 'monkey' and email: ''
|
118
|
+
Then she should be at the '<%= model_controller_routing_path %>/new' page
|
119
|
+
And she should see an errorExplanation message 'Email can't be blank'
|
120
|
+
And no <%= file_name %> with login: 'oona' should exist
|
121
|
+
When she registers an account with login: 'oona', password: 'monkey', password_confirmation: 'monkey' and email: 'unactivated@example.com'
|
122
|
+
Then she should be redirected to the home page
|
123
|
+
When she follows that redirect!
|
124
|
+
Then she should see a notice message 'Thanks for signing up!'
|
125
|
+
And a <%= file_name %> with login: 'oona' should exist
|
126
|
+
And the <%= file_name %> should have login: 'oona', and email: 'unactivated@example.com'
|
127
|
+
<% if options[:include_activation] %>
|
128
|
+
And the <%= file_name %>'s activation_code should not be nil
|
129
|
+
And the <%= file_name %>'s activated_at should be nil
|
130
|
+
And she should not be logged in
|
131
|
+
<% else %>
|
132
|
+
And oona should be logged in
|
133
|
+
<% end %>
|
134
|
+
|
135
|
+
<% if options[:include_activation] %>
|
136
|
+
Story: Activating an account
|
137
|
+
As a registered, but not yet activated, <%= file_name %>
|
138
|
+
I want to be able to activate my account
|
139
|
+
So that I can log in to the site
|
140
|
+
|
141
|
+
#
|
142
|
+
# Successful activation
|
143
|
+
#
|
144
|
+
Scenario: Not-yet-activated <%= file_name %> can activate her account
|
145
|
+
Given a registered <%= file_name %> named 'Reggie'
|
146
|
+
And the <%= file_name %> has activation_code: 'activate_me', activated_at: nil!
|
147
|
+
And we try hard to remember the <%= file_name %>'s updated_at, and created_at
|
148
|
+
When she goes to /activate/activate_me
|
149
|
+
Then she should be redirected to 'login'
|
150
|
+
When she follows that redirect!
|
151
|
+
Then she should see a notice message 'Signup complete!'
|
152
|
+
And a <%= file_name %> with login: 'reggie' should exist
|
153
|
+
And the <%= file_name %> should have login: 'reggie', and email: 'registered@example.com'
|
154
|
+
And the <%= file_name %>'s activation_code should be nil
|
155
|
+
And the <%= file_name %>'s activated_at should not be nil
|
156
|
+
And she should not be logged in
|
157
|
+
|
158
|
+
#
|
159
|
+
# Unsuccessful activation
|
160
|
+
#
|
161
|
+
Scenario: Not-yet-activated <%= file_name %> can't activate her account with a blank activation code
|
162
|
+
Given a registered <%= file_name %> named 'Reggie'
|
163
|
+
And the <%= file_name %> has activation_code: 'activate_me', activated_at: nil!
|
164
|
+
And we try hard to remember the <%= file_name %>'s updated_at, and created_at
|
165
|
+
When she goes to /activate/
|
166
|
+
Then she should be redirected to the home page
|
167
|
+
When she follows that redirect!
|
168
|
+
Then she should see an error message 'activation code was missing'
|
169
|
+
And a <%= file_name %> with login: 'reggie' should exist
|
170
|
+
And the <%= file_name %> should have login: 'reggie', activation_code: 'activate_me', and activated_at: nil!
|
171
|
+
And the <%= file_name %>'s updated_at should stay the same under to_s
|
172
|
+
And she should not be logged in
|
173
|
+
|
174
|
+
Scenario: Not-yet-activated <%= file_name %> can't activate her account with a bogus activation code
|
175
|
+
Given a registered <%= file_name %> named 'Reggie'
|
176
|
+
And the <%= file_name %> has activation_code: 'activate_me', activated_at: nil!
|
177
|
+
And we try hard to remember the <%= file_name %>'s updated_at, and created_at
|
178
|
+
When she goes to /activate/i_haxxor_joo
|
179
|
+
Then she should be redirected to the home page
|
180
|
+
When she follows that redirect!
|
181
|
+
Then she should see an error message 'couldn\'t find a <%= file_name %> with that activation code'
|
182
|
+
And a <%= file_name %> with login: 'reggie' should exist
|
183
|
+
And the <%= file_name %> should have login: 'reggie', activation_code: 'activate_me', and activated_at: nil!
|
184
|
+
And the <%= file_name %>'s updated_at should stay the same under to_s
|
185
|
+
And she should not be logged in
|
186
|
+
<% end %>
|
@@ -0,0 +1,134 @@
|
|
1
|
+
Users want to know that nobody can masquerade as them. We want to extend trust
|
2
|
+
only to visitors who present the appropriate credentials. Everyone wants this
|
3
|
+
identity verification to be as secure and convenient as possible.
|
4
|
+
|
5
|
+
Story: Logging in
|
6
|
+
As an anonymous <%= file_name %> with an account
|
7
|
+
I want to log in to my account
|
8
|
+
So that I can be myself
|
9
|
+
|
10
|
+
#
|
11
|
+
# Log in: get form
|
12
|
+
#
|
13
|
+
Scenario: Anonymous <%= file_name %> can get a login form.
|
14
|
+
Given an anonymous <%= file_name %>
|
15
|
+
When she goes to /login
|
16
|
+
Then she should be at the new <%= controller_file_name %> page
|
17
|
+
And the page should look AWESOME
|
18
|
+
And she should see a <form> containing a textfield: Login, password: Password, and submit: 'Log in'
|
19
|
+
|
20
|
+
#
|
21
|
+
# Log in successfully, but don't remember me
|
22
|
+
#
|
23
|
+
Scenario: Anonymous <%= file_name %> can log in
|
24
|
+
Given an anonymous <%= file_name %>
|
25
|
+
And an activated <%= file_name %> named 'reggie'
|
26
|
+
When she creates a singular <%= controller_file_name %> with login: 'reggie', password: 'monkey', remember me: ''
|
27
|
+
Then she should be redirected to the home page
|
28
|
+
When she follows that redirect!
|
29
|
+
Then she should see a notice message 'Logged in successfully'
|
30
|
+
And reggie should be logged in
|
31
|
+
And she should not have an auth_token cookie
|
32
|
+
|
33
|
+
Scenario: Logged-in <%= file_name %> who logs in should be the new one
|
34
|
+
Given an activated <%= file_name %> named 'reggie'
|
35
|
+
And an activated <%= file_name %> logged in as 'oona'
|
36
|
+
When she creates a singular <%= controller_file_name %> with login: 'reggie', password: 'monkey', remember me: ''
|
37
|
+
Then she should be redirected to the home page
|
38
|
+
When she follows that redirect!
|
39
|
+
Then she should see a notice message 'Logged in successfully'
|
40
|
+
And reggie should be logged in
|
41
|
+
And she should not have an auth_token cookie
|
42
|
+
|
43
|
+
#
|
44
|
+
# Log in successfully, remember me
|
45
|
+
#
|
46
|
+
Scenario: Anonymous <%= file_name %> can log in and be remembered
|
47
|
+
Given an anonymous <%= file_name %>
|
48
|
+
And an activated <%= file_name %> named 'reggie'
|
49
|
+
When she creates a singular <%= controller_file_name %> with login: 'reggie', password: 'monkey', remember me: '1'
|
50
|
+
Then she should be redirected to the home page
|
51
|
+
When she follows that redirect!
|
52
|
+
Then she should see a notice message 'Logged in successfully'
|
53
|
+
And reggie should be logged in
|
54
|
+
And she should have an auth_token cookie
|
55
|
+
# assumes fixtures were run sometime
|
56
|
+
And her session store should have <%= file_name %>_id: 4
|
57
|
+
|
58
|
+
#
|
59
|
+
# Log in unsuccessfully
|
60
|
+
#
|
61
|
+
|
62
|
+
Scenario: Logged-in <%= file_name %> who fails logs in should be logged out
|
63
|
+
Given an activated <%= file_name %> named 'oona'
|
64
|
+
When she creates a singular <%= controller_file_name %> with login: 'oona', password: '1234oona', remember me: '1'
|
65
|
+
Then she should be redirected to the home page
|
66
|
+
When she follows that redirect!
|
67
|
+
Then she should see a notice message 'Logged in successfully'
|
68
|
+
And oona should be logged in
|
69
|
+
And she should have an auth_token cookie
|
70
|
+
When she creates a singular <%= controller_file_name %> with login: 'reggie', password: 'i_haxxor_joo'
|
71
|
+
Then she should be at the new <%= controller_file_name %> page
|
72
|
+
Then she should see an error message 'Couldn't log you in as 'reggie''
|
73
|
+
And she should not be logged in
|
74
|
+
And she should not have an auth_token cookie
|
75
|
+
And her session store should not have <%= file_name %>_id
|
76
|
+
|
77
|
+
Scenario: Log-in with bogus info should fail until it doesn't
|
78
|
+
Given an activated <%= file_name %> named 'reggie'
|
79
|
+
When she creates a singular <%= controller_file_name %> with login: 'reggie', password: 'i_haxxor_joo'
|
80
|
+
Then she should be at the new <%= controller_file_name %> page
|
81
|
+
Then she should see an error message 'Couldn't log you in as 'reggie''
|
82
|
+
And she should not be logged in
|
83
|
+
And she should not have an auth_token cookie
|
84
|
+
And her session store should not have <%= file_name %>_id
|
85
|
+
When she creates a singular <%= controller_file_name %> with login: 'reggie', password: ''
|
86
|
+
Then she should be at the new <%= controller_file_name %> page
|
87
|
+
Then she should see an error message 'Couldn't log you in as 'reggie''
|
88
|
+
And she should not be logged in
|
89
|
+
And she should not have an auth_token cookie
|
90
|
+
And her session store should not have <%= file_name %>_id
|
91
|
+
When she creates a singular <%= controller_file_name %> with login: '', password: 'monkey'
|
92
|
+
Then she should be at the new <%= controller_file_name %> page
|
93
|
+
Then she should see an error message 'Couldn't log you in as '''
|
94
|
+
And she should not be logged in
|
95
|
+
And she should not have an auth_token cookie
|
96
|
+
And her session store should not have <%= file_name %>_id
|
97
|
+
When she creates a singular <%= controller_file_name %> with login: 'leonard_shelby', password: 'monkey'
|
98
|
+
Then she should be at the new <%= controller_file_name %> page
|
99
|
+
Then she should see an error message 'Couldn't log you in as 'leonard_shelby''
|
100
|
+
And she should not be logged in
|
101
|
+
And she should not have an auth_token cookie
|
102
|
+
And her session store should not have <%= file_name %>_id
|
103
|
+
When she creates a singular <%= controller_file_name %> with login: 'reggie', password: 'monkey', remember me: '1'
|
104
|
+
Then she should be redirected to the home page
|
105
|
+
When she follows that redirect!
|
106
|
+
Then she should see a notice message 'Logged in successfully'
|
107
|
+
And reggie should be logged in
|
108
|
+
And she should have an auth_token cookie
|
109
|
+
# assumes fixtures were run sometime
|
110
|
+
And her session store should have <%= file_name %>_id: 4
|
111
|
+
|
112
|
+
|
113
|
+
#
|
114
|
+
# Log out successfully (should always succeed)
|
115
|
+
#
|
116
|
+
Scenario: Anonymous (logged out) <%= file_name %> can log out.
|
117
|
+
Given an anonymous <%= file_name %>
|
118
|
+
When she goes to /logout
|
119
|
+
Then she should be redirected to the home page
|
120
|
+
When she follows that redirect!
|
121
|
+
Then she should see a notice message 'You have been logged out'
|
122
|
+
And she should not be logged in
|
123
|
+
And she should not have an auth_token cookie
|
124
|
+
And her session store should not have <%= file_name %>_id
|
125
|
+
|
126
|
+
Scenario: Logged in <%= file_name %> can log out.
|
127
|
+
Given an activated <%= file_name %> logged in as 'reggie'
|
128
|
+
When she goes to /logout
|
129
|
+
Then she should be redirected to the home page
|
130
|
+
When she follows that redirect!
|
131
|
+
Then she should see a notice message 'You have been logged out'
|
132
|
+
And she should not be logged in
|
133
|
+
And she should not have an auth_token cookie
|
134
|
+
And her session store should not have <%= file_name %>_id
|