bootstrap_devise_base 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. data/Gemfile +54 -0
  2. data/Gemfile.lock +237 -0
  3. data/Rakefile +7 -0
  4. data/app/.svn/all-wcprops +5 -0
  5. data/app/.svn/entries +31 -0
  6. data/app/assets/images/rails.png +0 -0
  7. data/app/assets/javascripts/application.js +16 -0
  8. data/app/assets/javascripts/registrations.js.coffee +3 -0
  9. data/app/assets/stylesheets/application.css +23 -0
  10. data/app/assets/stylesheets/bootstrap.scss +29 -0
  11. data/app/assets/stylesheets/forms.scss +481 -0
  12. data/app/assets/stylesheets/mixins.scss +220 -0
  13. data/app/assets/stylesheets/patterns.scss +1061 -0
  14. data/app/assets/stylesheets/registrations.css.scss +3 -0
  15. data/app/assets/stylesheets/reset.scss +144 -0
  16. data/app/assets/stylesheets/scaffolding.scss +144 -0
  17. data/app/assets/stylesheets/tables.scss +226 -0
  18. data/app/assets/stylesheets/type.scss +190 -0
  19. data/app/assets/stylesheets/variables.scss +60 -0
  20. data/app/controllers/.svn/all-wcprops +11 -0
  21. data/app/controllers/.svn/entries +62 -0
  22. data/app/controllers/.svn/text-base/assets_offline_controller.rb.svn-base +85 -0
  23. data/app/controllers/application_controller.rb +6 -0
  24. data/app/controllers/authentications_controller.rb +34 -0
  25. data/app/controllers/home_controller.rb +83 -0
  26. data/app/controllers/registrations_controller.rb +18 -0
  27. data/app/helpers/application_helper.rb +2 -0
  28. data/app/helpers/authentications_helper.rb +2 -0
  29. data/app/helpers/devise_helper.rb +29 -0
  30. data/app/helpers/home_helper.rb +2 -0
  31. data/app/helpers/registrations_helper.rb +2 -0
  32. data/app/mailers/.gitkeep +0 -0
  33. data/app/models/.gitkeep +0 -0
  34. data/app/models/authentication.rb +3 -0
  35. data/app/models/user.rb +20 -0
  36. data/app/views/authentications/_form.html.erb +16 -0
  37. data/app/views/authentications/edit.html.erb +8 -0
  38. data/app/views/authentications/index.html.erb +22 -0
  39. data/app/views/authentications/new.html.erb +5 -0
  40. data/app/views/authentications/show.html.erb +20 -0
  41. data/app/views/devise/confirmations/new.html.erb +12 -0
  42. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  43. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  44. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  45. data/app/views/devise/passwords/edit.html.erb +16 -0
  46. data/app/views/devise/passwords/new.html.erb +12 -0
  47. data/app/views/devise/sessions/new.html.erb +58 -0
  48. data/app/views/devise/shared/_links.erb +25 -0
  49. data/app/views/devise/unlocks/new.html.erb +12 -0
  50. data/app/views/home/_form.html.erb +17 -0
  51. data/app/views/home/edit.html.erb +6 -0
  52. data/app/views/home/index.html.erb +21 -0
  53. data/app/views/home/new.html.erb +5 -0
  54. data/app/views/home/show.html.erb +5 -0
  55. data/app/views/layouts/application.html.erb +112 -0
  56. data/app/views/registrations/edit.html.erb +25 -0
  57. data/app/views/registrations/new.html.erb +47 -0
  58. data/bootstrap_devise_base.gemspec +20 -0
  59. data/config.ru +4 -0
  60. data/config/.svn/all-wcprops +11 -0
  61. data/config/.svn/entries +62 -0
  62. data/config/.svn/text-base/routes.rb.svn-base +3 -0
  63. data/config/application.rb +48 -0
  64. data/config/boot.rb +6 -0
  65. data/config/cucumber.yml +8 -0
  66. data/config/database.yml +45 -0
  67. data/config/environment.rb +5 -0
  68. data/config/environments/development.rb +30 -0
  69. data/config/environments/production.rb +60 -0
  70. data/config/environments/test.rb +39 -0
  71. data/config/initializers/backtrace_silencers.rb +7 -0
  72. data/config/initializers/devise.rb +208 -0
  73. data/config/initializers/inflections.rb +10 -0
  74. data/config/initializers/mime_types.rb +5 -0
  75. data/config/initializers/omniauth.rb +3 -0
  76. data/config/initializers/secret_token.rb +7 -0
  77. data/config/initializers/session_store.rb +8 -0
  78. data/config/initializers/wrap_parameters.rb +14 -0
  79. data/config/locales/devise.en.yml +58 -0
  80. data/config/locales/en.yml +13 -0
  81. data/config/routes.rb +64 -0
  82. data/db/migrate/20111121201415_create_users.rb +8 -0
  83. data/db/migrate/20111121201511_add_devise_to_users.rb +31 -0
  84. data/db/migrate/20111127100158_create_authentications.rb +14 -0
  85. data/db/schema.rb +42 -0
  86. data/db/seeds.rb +7 -0
  87. data/doc/README_FOR_APP +2 -0
  88. data/features/manage_sign_ups.feature +28 -0
  89. data/features/step_definitions/sign_up_steps.rb +27 -0
  90. data/features/step_definitions/web_steps.rb +254 -0
  91. data/features/support/env.rb +56 -0
  92. data/features/support/paths.rb +39 -0
  93. data/features/support/selectors.rb +39 -0
  94. data/init.rb +1 -0
  95. data/lib/.svn/all-wcprops +11 -0
  96. data/lib/.svn/entries +65 -0
  97. data/lib/.svn/text-base/assets_offline.rb.svn-base +6 -0
  98. data/lib/assets/.gitkeep +0 -0
  99. data/lib/bootstap_devise_base.rb~ +6 -0
  100. data/lib/bootstrap_devise_base.rb +6 -0
  101. data/lib/bootstrap_devise_base/.svn/all-wcprops +11 -0
  102. data/lib/bootstrap_devise_base/.svn/entries +62 -0
  103. data/lib/bootstrap_devise_base/.svn/text-base/version.rb.svn-base +3 -0
  104. data/lib/bootstrap_devise_base/version.rb +3 -0
  105. data/lib/tasks/.gitkeep +0 -0
  106. data/lib/tasks/cucumber.rake +65 -0
  107. data/log/.gitkeep +0 -0
  108. data/log/development.log +977 -0
  109. data/log/production.log +44 -0
  110. data/log/test.log +799 -0
  111. data/public/404.html +26 -0
  112. data/public/422.html +26 -0
  113. data/public/500.html +26 -0
  114. data/public/assets/application-902e25928a309d43246c45cd2facd7d3.js +19 -0
  115. data/public/assets/application-902e25928a309d43246c45cd2facd7d3.js.gz +0 -0
  116. data/public/assets/application-a5e3fc47c863d5a64c7380ed33b187b6.css +1 -0
  117. data/public/assets/application-a5e3fc47c863d5a64c7380ed33b187b6.css.gz +0 -0
  118. data/public/assets/application.css +1 -0
  119. data/public/assets/application.css.gz +0 -0
  120. data/public/assets/application.js +19 -0
  121. data/public/assets/application.js.gz +0 -0
  122. data/public/assets/manifest.yml +4 -0
  123. data/public/assets/rails-e4b51606cd77fda2615e7439907bfc92.png +0 -0
  124. data/public/assets/rails.png +0 -0
  125. data/public/favicon.ico +0 -0
  126. data/public/robots.txt +5 -0
  127. data/script/cucumber +10 -0
  128. data/script/rails +6 -0
  129. data/test/fixtures/.gitkeep +0 -0
  130. data/test/functional/.gitkeep +0 -0
  131. data/test/integration/.gitkeep +0 -0
  132. data/test/performance/browsing_test.rb +12 -0
  133. data/test/test_helper.rb +13 -0
  134. data/test/unit/.gitkeep +0 -0
  135. data/vendor/assets/stylesheets/.gitkeep +0 -0
  136. data/vendor/plugins/.gitkeep +0 -0
  137. metadata +181 -0
@@ -0,0 +1,13 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
6
+ company: "Torex 2011"
7
+ project_name: "Template Project"
8
+ sign_up: "Sign up"
9
+ sign_in: "Sign in"
10
+ home: "Home"
11
+ about: "About"
12
+ contact: "Contact"
13
+
@@ -0,0 +1,64 @@
1
+ Template::Application.routes.draw do
2
+ resources :authentications
3
+
4
+ match '/auth/:provider/callback' => 'authentications#create'
5
+ devise_for :users, :controllers => {:registrations => 'registrations'}
6
+ match '/user' => "home#index", :as => :user_root
7
+ resources :HomeController
8
+ # The priority is based upon order of creation:
9
+ # first created -> highest priority.
10
+
11
+ # Sample of regular route:
12
+ # match 'products/:id' => 'catalog#view'
13
+ # Keep in mind you can assign values other than :controller and :action
14
+
15
+ # Sample of named route:
16
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
17
+ # This route can be invoked with purchase_url(:id => product.id)
18
+
19
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
20
+ # resources :products
21
+
22
+ # Sample resource route with options:
23
+ # resources :products do
24
+ # member do
25
+ # get 'short'
26
+ # post 'toggle'
27
+ # end
28
+ #
29
+ # collection do
30
+ # get 'sold'
31
+ # end
32
+ # end
33
+
34
+ # Sample resource route with sub-resources:
35
+ # resources :products do
36
+ # resources :comments, :sales
37
+ # resource :seller
38
+ # end
39
+
40
+ # Sample resource route with more complex sub-resources
41
+ # resources :products do
42
+ # resources :comments
43
+ # resources :sales do
44
+ # get 'recent', :on => :collection
45
+ # end
46
+ # end
47
+
48
+ # Sample resource route within a namespace:
49
+ # namespace :admin do
50
+ # # Directs /admin/products/* to Admin::ProductsController
51
+ # # (app/controllers/admin/products_controller.rb)
52
+ # resources :products
53
+ # end
54
+
55
+ # You can have the root of your site routed with "root"
56
+ # just remember to delete public/index.html.
57
+ root :to => 'home#index'
58
+
59
+ # See how all your routes lay out with "rake routes"
60
+
61
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
62
+ # Note: This route will make all actions in every controller accessible via GET requests.
63
+ # match ':controller(/:action(/:id(.:format)))'
64
+ end
@@ -0,0 +1,8 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,31 @@
1
+ class AddDeviseToUsers < ActiveRecord::Migration
2
+ def self.up
3
+ change_table(:users) do |t|
4
+ t.database_authenticatable :null => false
5
+ t.recoverable
6
+ t.rememberable
7
+ t.trackable
8
+
9
+ # t.encryptable
10
+ # t.confirmable
11
+ # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
12
+ # t.token_authenticatable
13
+
14
+
15
+ # Uncomment below if timestamps were not included in your original model.
16
+ # t.timestamps
17
+ end
18
+
19
+ add_index :users, :email, :unique => true
20
+ add_index :users, :reset_password_token, :unique => true
21
+ # add_index :users, :confirmation_token, :unique => true
22
+ # add_index :users, :unlock_token, :unique => true
23
+ # add_index :users, :authentication_token, :unique => true
24
+ end
25
+
26
+ def self.down
27
+ # By default, we don't want to make any assumption about how to roll back a migration when your
28
+ # model already existed. Please edit below which fields you would like to remove in this migration.
29
+ raise ActiveRecord::IrreversibleMigration
30
+ end
31
+ end
@@ -0,0 +1,14 @@
1
+ class CreateAuthentications < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :authentications do |t|
4
+ t.integer :user_id
5
+ t.string :provider
6
+ t.string :uid
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :authentications
13
+ end
14
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20111127100158) do
15
+
16
+ create_table "authentications", :force => true do |t|
17
+ t.integer "user_id"
18
+ t.string "provider"
19
+ t.string "uid"
20
+ t.datetime "created_at"
21
+ t.datetime "updated_at"
22
+ end
23
+
24
+ create_table "users", :force => true do |t|
25
+ t.datetime "created_at"
26
+ t.datetime "updated_at"
27
+ t.string "email", :default => "", :null => false
28
+ t.string "encrypted_password", :limit => 128, :default => "", :null => false
29
+ t.string "reset_password_token"
30
+ t.datetime "reset_password_sent_at"
31
+ t.datetime "remember_created_at"
32
+ t.integer "sign_in_count", :default => 0
33
+ t.datetime "current_sign_in_at"
34
+ t.datetime "last_sign_in_at"
35
+ t.string "current_sign_in_ip"
36
+ t.string "last_sign_in_ip"
37
+ end
38
+
39
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
40
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
41
+
42
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
@@ -0,0 +1,2 @@
1
+ Use this README file to introduce your application and point to useful places in the API for learning more.
2
+ Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
@@ -0,0 +1,28 @@
1
+ @javascript
2
+ Feature: Manage sign_ups
3
+ In order to get access to protected sections of the site
4
+ As a user
5
+ I want to be able to sign up
6
+
7
+ Background:
8
+ Given I am not logged in
9
+ And I am on the home page
10
+ And I go to the sign up page
11
+
12
+ Scenario: User signs up with valid data
13
+ And I fill in the following:
14
+ | Email | user@test.com |
15
+ | Password | please |
16
+ | Password confirmation | please |
17
+ And I press "Sign up"
18
+ Then I should see "Sign out user@test.com"
19
+ Given I am not logged in
20
+ Then I should see "Sign in"
21
+ And I go to the sign in page
22
+ And I fill in the following:
23
+ | Email | user@test.com |
24
+ | Password | please |
25
+ And I press "Sign in"
26
+ Then I should see "Sign out user@test.com"
27
+
28
+
@@ -0,0 +1,27 @@
1
+ Given /^the following sign_ups:$/ do |sign_ups|
2
+ SignUp.create!(sign_ups.hashes)
3
+ end
4
+
5
+ When /^I delete the (\d+)(?:st|nd|rd|th) sign_up$/ do |pos|
6
+ visit sign_ups_path
7
+ within("table tr:nth-child(#{pos.to_i+1})") do
8
+ click_link "Destroy"
9
+ end
10
+ end
11
+
12
+ Then /^I should see the following sign_ups:$/ do |expected_sign_ups_table|
13
+ expected_sign_ups_table.diff!(tableish('table tr', 'td,th'))
14
+ end
15
+
16
+ Then /^I go to the home page$/ do
17
+ visit '/'
18
+ end
19
+
20
+ Given /^I am not logged in$/ do
21
+ step %{I sign out}
22
+ end
23
+
24
+ Then /^I sign out$/ do
25
+ visit '/users/sign_out'
26
+ end
27
+
@@ -0,0 +1,254 @@
1
+ # TL;DR: YOU SHOULD DELETE THIS FILE
2
+ #
3
+ # This file was generated by Cucumber-Rails and is only here to get you a head start
4
+ # These step definitions are thin wrappers around the Capybara/Webrat API that lets you
5
+ # visit pages, interact with widgets and make assertions about page content.
6
+ #
7
+ # If you use these step definitions as basis for your features you will quickly end up
8
+ # with features that are:
9
+ #
10
+ # * Hard to maintain
11
+ # * Verbose to read
12
+ #
13
+ # A much better approach is to write your own higher level step definitions, following
14
+ # the advice in the following blog posts:
15
+ #
16
+ # * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
17
+ # * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
18
+ # * http://elabs.se/blog/15-you-re-cuking-it-wrong
19
+ #
20
+
21
+
22
+ require 'uri'
23
+ require 'cgi'
24
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
25
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
26
+
27
+ module WithinHelpers
28
+ def with_scope(locator)
29
+ locator ? within(*selector_for(locator)) { yield } : yield
30
+ end
31
+ end
32
+ World(WithinHelpers)
33
+
34
+ # Single-line step scoper
35
+ When /^(.*) within (.*[^:])$/ do |step, parent|
36
+ with_scope(parent) { When step }
37
+ end
38
+
39
+ # Multi-line step scoper
40
+ When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string|
41
+ with_scope(parent) { When "#{step}:", table_or_string }
42
+ end
43
+
44
+ Given /^(?:|I )am on (.+)$/ do |page_name|
45
+ visit path_to(page_name)
46
+ end
47
+
48
+ When /^(?:|I )go to (.+)$/ do |page_name|
49
+ visit path_to(page_name)
50
+ end
51
+
52
+ When /^(?:|I )press "([^"]*)"$/ do |button|
53
+ click_button(button)
54
+ end
55
+
56
+ When /^(?:|I )follow "([^"]*)"$/ do |link|
57
+ click_link(link)
58
+ end
59
+
60
+ When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
61
+ fill_in(field, :with => value)
62
+ end
63
+
64
+ When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
65
+ fill_in(field, :with => value)
66
+ end
67
+
68
+ # Use this to fill in an entire form with data from a table. Example:
69
+ #
70
+ # When I fill in the following:
71
+ # | Account Number | 5002 |
72
+ # | Expiry date | 2009-11-01 |
73
+ # | Note | Nice guy |
74
+ # | Wants Email? | |
75
+ #
76
+ # TODO: Add support for checkbox, select or option
77
+ # based on naming conventions.
78
+ #
79
+ When /^(?:|I )fill in the following:$/ do |fields|
80
+ fields.rows_hash.each do |name, value|
81
+ When %{I fill in "#{name}" with "#{value}"}
82
+ end
83
+ end
84
+
85
+ When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
86
+ select(value, :from => field)
87
+ end
88
+
89
+ When /^(?:|I )check "([^"]*)"$/ do |field|
90
+ check(field)
91
+ end
92
+
93
+ When /^(?:|I )uncheck "([^"]*)"$/ do |field|
94
+ uncheck(field)
95
+ end
96
+
97
+ When /^(?:|I )choose "([^"]*)"$/ do |field|
98
+ choose(field)
99
+ end
100
+
101
+ When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
102
+ attach_file(field, File.expand_path(path))
103
+ end
104
+
105
+ Then /^(?:|I )should see "([^"]*)"$/ do |text|
106
+ if page.respond_to? :should
107
+ page.should have_content(text)
108
+ else
109
+ assert page.has_content?(text)
110
+ end
111
+ end
112
+
113
+ Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
114
+ regexp = Regexp.new(regexp)
115
+
116
+ if page.respond_to? :should
117
+ page.should have_xpath('//*', :text => regexp)
118
+ else
119
+ assert page.has_xpath?('//*', :text => regexp)
120
+ end
121
+ end
122
+
123
+ Then /^(?:|I )should not see "([^"]*)"$/ do |text|
124
+ if page.respond_to? :should
125
+ page.should have_no_content(text)
126
+ else
127
+ assert page.has_no_content?(text)
128
+ end
129
+ end
130
+
131
+ Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
132
+ regexp = Regexp.new(regexp)
133
+
134
+ if page.respond_to? :should
135
+ page.should have_no_xpath('//*', :text => regexp)
136
+ else
137
+ assert page.has_no_xpath?('//*', :text => regexp)
138
+ end
139
+ end
140
+
141
+ Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
142
+ with_scope(parent) do
143
+ field = find_field(field)
144
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
145
+ if field_value.respond_to? :should
146
+ field_value.should =~ /#{value}/
147
+ else
148
+ assert_match(/#{value}/, field_value)
149
+ end
150
+ end
151
+ end
152
+
153
+ Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
154
+ with_scope(parent) do
155
+ field = find_field(field)
156
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
157
+ if field_value.respond_to? :should_not
158
+ field_value.should_not =~ /#{value}/
159
+ else
160
+ assert_no_match(/#{value}/, field_value)
161
+ end
162
+ end
163
+ end
164
+
165
+ Then /^the "([^"]*)" field should have the error "([^"]*)"$/ do |field, error_message|
166
+ element = find_field(field)
167
+ classes = element.find(:xpath, '..')[:class].split(' ')
168
+
169
+ form_for_input = element.find(:xpath, 'ancestor::form[1]')
170
+ using_formtastic = form_for_input[:class].include?('formtastic')
171
+ error_class = using_formtastic ? 'error' : 'field_with_errors'
172
+
173
+ if classes.respond_to? :should
174
+ classes.should include(error_class)
175
+ else
176
+ assert classes.include?(error_class)
177
+ end
178
+
179
+ if page.respond_to?(:should)
180
+ if using_formtastic
181
+ error_paragraph = element.find(:xpath, '../*[@class="inline-errors"][1]')
182
+ error_paragraph.should have_content(error_message)
183
+ else
184
+ page.should have_content("#{field.titlecase} #{error_message}")
185
+ end
186
+ else
187
+ if using_formtastic
188
+ error_paragraph = element.find(:xpath, '../*[@class="inline-errors"][1]')
189
+ assert error_paragraph.has_content?(error_message)
190
+ else
191
+ assert page.has_content?("#{field.titlecase} #{error_message}")
192
+ end
193
+ end
194
+ end
195
+
196
+ Then /^the "([^"]*)" field should have no error$/ do |field|
197
+ element = find_field(field)
198
+ classes = element.find(:xpath, '..')[:class].split(' ')
199
+ if classes.respond_to? :should
200
+ classes.should_not include('field_with_errors')
201
+ classes.should_not include('error')
202
+ else
203
+ assert !classes.include?('field_with_errors')
204
+ assert !classes.include?('error')
205
+ end
206
+ end
207
+
208
+ Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
209
+ with_scope(parent) do
210
+ field_checked = find_field(label)['checked']
211
+ if field_checked.respond_to? :should
212
+ field_checked.should be_true
213
+ else
214
+ assert field_checked
215
+ end
216
+ end
217
+ end
218
+
219
+ Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
220
+ with_scope(parent) do
221
+ field_checked = find_field(label)['checked']
222
+ if field_checked.respond_to? :should
223
+ field_checked.should be_false
224
+ else
225
+ assert !field_checked
226
+ end
227
+ end
228
+ end
229
+
230
+ Then /^(?:|I )should be on (.+)$/ do |page_name|
231
+ current_path = URI.parse(current_url).path
232
+ if current_path.respond_to? :should
233
+ current_path.should == path_to(page_name)
234
+ else
235
+ assert_equal path_to(page_name), current_path
236
+ end
237
+ end
238
+
239
+ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
240
+ query = URI.parse(current_url).query
241
+ actual_params = query ? CGI.parse(query) : {}
242
+ expected_params = {}
243
+ expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
244
+
245
+ if actual_params.respond_to? :should
246
+ actual_params.should == expected_params
247
+ else
248
+ assert_equal expected_params, actual_params
249
+ end
250
+ end
251
+
252
+ Then /^show me the page$/ do
253
+ save_and_open_page
254
+ end