Permalink
Browse files

signup wizard validations

  • Loading branch information...
1 parent 5483ea5 commit f92fbb7a774cc5a2df03d29c6ac67c7096aab9e4 @schadenfred committed Apr 15, 2012
View
5 Gemfile
@@ -46,8 +46,9 @@ group :test, :development do
gem 'ruby_parser'
gem 'taps'
gem 'heroku'
- gem 'ruby-debug19'
- gem 'ruby-prof'
+ # gem 'ruby-debug19'
+ # gem 'ruby-prof'
+ gem 'debugger'
# Rspec
gem 'rspec-rails'
View
24 Gemfile.lock
@@ -29,7 +29,6 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.2.7)
- archive-tar-minitar (0.5.2)
arel (3.0.2)
bcrypt-ruby (3.0.1)
best_in_place (1.0.6)
@@ -72,6 +71,13 @@ GEM
nokogiri (>= 1.5.0)
daemons (1.1.8)
database_cleaner (0.7.2)
+ debugger (1.1.1)
+ columnize (>= 0.3.1)
+ debugger-linecache (~> 1.1)
+ debugger-ruby_core_source (~> 1.1)
+ debugger-linecache (1.1.1)
+ debugger-ruby_core_source (>= 1.1.1)
+ debugger-ruby_core_source (1.1.1)
devise (2.0.4)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
@@ -150,8 +156,6 @@ GEM
railties (>= 3.0.0)
launchy (2.1.0)
addressable (~> 2.2.6)
- linecache19 (0.5.12)
- ruby_core_source (>= 0.1.4)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -203,17 +207,6 @@ GEM
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.9.0)
- ruby-debug-base19 (0.11.25)
- columnize (>= 0.3.1)
- linecache19 (>= 0.5.11)
- ruby_core_source (>= 0.1.4)
- ruby-debug19 (0.11.6)
- columnize (>= 0.3.1)
- linecache19 (>= 0.5.11)
- ruby-debug-base19 (>= 0.11.19)
- ruby-prof (0.10.8)
- ruby_core_source (0.1.5)
- archive-tar-minitar (>= 0.5.2)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
rubyzip (0.9.6.1)
@@ -288,6 +281,7 @@ DEPENDENCIES
coffee-script
cucumber-rails
database_cleaner
+ debugger
devise
email_spec
eventmachine
@@ -313,8 +307,6 @@ DEPENDENCIES
pg (= 0.12.2)
rails (= 3.2.3)
rspec-rails
- ruby-debug19
- ruby-prof
ruby_parser
sass-rails
selenium-webdriver
View
14 app/controllers/after_signup_wizard_controller.rb
@@ -5,9 +5,17 @@ class AfterSignupWizardController < ApplicationController
def show
@user = current_user
case step
- when :choose_password
- @user = current_user
- end
+ when :choose_password
+ @title = "Step 2"
+ when :choose_subdomain
+ @title = "Step 3"
+ end
+ render_wizard
+ end
+
+ def update
+ @user = current_user
+ @user.update_attributes(params[:user])
render_wizard
end
end
View
2 app/controllers/registrations_controller.rb
@@ -20,7 +20,7 @@ def update
respond_with resource, :location => after_update_path_for(resource)
else
clean_up_passwords(resource)
- respond_with_navigational(resource){ render_with_scope :edit }
+ respond_with_navigational(resource)
end
end
View
1 app/models/user.rb
@@ -27,7 +27,6 @@ class User < ActiveRecord::Base
uniqueness: { case_sensitive: false }
validates :subdomain, presence: true, on: :update,
- allow_blank: true,
uniqueness: { case_sensitive: false },
format: { with: subdomain_regex,
message: "The subdomain can only contain numbers,
View
2 app/views/after_signup_wizard/choose_subdomain.html.haml
@@ -11,7 +11,7 @@
Step 3: Choose Subdomain
%br/
%legend Step 3: Choose your subdomain
- = simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, class: "form-horizontal" } ) do |f|
+ = simple_form_for(resource, :url => registration_path(resource_name), :html => { :method => :put, class: "form-horizontal" } ) do |f|
= f.input :subdomain, wrapper: :append do
= f.input_field :subdomain, placeholder: @user.subdomain
= content_tag :span, ".merciboq.com", class: "add-on"
View
2 app/views/registrations/edit.html.haml
@@ -2,7 +2,7 @@
.span12.form-horizontal
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }, :validate => true) do |f|
%fieldset
- %legend Edit your settings
+ %legend Fredit your settings
= f.input :name
= f.input :subdomain
= f.input :email
View
2 config/environments/development.rb
@@ -23,7 +23,7 @@
config.action_mailer.perform_deliveries = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
-
+ config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
View
10 features/user/authentication/sign_up.feature
@@ -23,10 +23,14 @@ Feature: Sign up
When I follow "Confirm my account" in the email
Then I should see "| Confirm your account" in the title
And I fill in the following:
- | Password | password |
- | Password confirmation | password |
+ | Password | password |
+ | Password confirmation | password |
And I press "Choose my password"
- Then I should see "Your account was successfully confirmed."
+ And I should see "Your account was successfully confirmed."
+ And I fill in the following:
+ | Subdomain | sarah-silverman |
+ And I press "Choose my subdomain"
+ Then show me the page
Scenario: Unregistered user signs up with invalid email
And I fill in the following:

0 comments on commit f92fbb7

Please sign in to comment.