Browse files

add registration form

  • Loading branch information...
1 parent 899383c commit 46cb9f011490db64dccb6be7d75c61291249397e @avalanche123 committed May 21, 2011
View
1 .gitignore
@@ -2,3 +2,4 @@
db/*.sqlite3
log/*.log
tmp/
+webrat.log
View
5 app/controllers/accounts_controller.rb
@@ -0,0 +1,5 @@
+class AccountsController < ActionController::Base
+ def new
+ @account = Account.new
+ end
+end
View
2 app/models/account.rb
@@ -0,0 +1,2 @@
+class Account < ActiveRecord::Base
+end
View
17 app/views/accounts/new.erb
@@ -0,0 +1,17 @@
+<h1>Registration</h1>
+
+<section id="registration_form">
+ <%= form_for :account, @account, :url => { :action => "create" } do |f| %>
+ <ol>
+ <li>
+ <%= label_tag(:username, "Username:") %>
+ <%= f.text_field :username %>
+ </li>
+ <li>
+ <%= label_tag(:password, "Password:") %>
+ <%= f.password_field :password %>
+ </li>
+ <li><%= submit_tag "Register" %></li>
+ </ol>
+ <% end %>
+</section>
View
2 config/routes.rb
@@ -55,4 +55,6 @@
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
+
+ resource :account
end
View
14 db/migrate/20110521060542_create_accounts.rb
@@ -0,0 +1,14 @@
+class CreateAccounts < ActiveRecord::Migration
+ def self.up
+ create_table :accounts do |t|
+ t.string :username
+ t.string :password
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :accounts
+ end
+end
View
9 db/schema.rb
@@ -10,6 +10,13 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 0) do
+ActiveRecord::Schema.define(:version => 20110521060542) do
+
+ create_table "accounts", :force => true do |t|
+ t.string "username"
+ t.string "password"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
end
View
12 features/registration.feature
@@ -0,0 +1,12 @@
+Feature: registration
+
+ As a user
+ I want to register
+ So that I can track my game stats
+
+ Scenario: user sees a registration form
+ Given I am not logged in
+ When I go to registration page
+ Then I should see "Registration"
+ And I should see "Username:"
+ And I should see "Password:"
View
3 features/step_definitions/matermind_steps.rb
@@ -0,0 +1,3 @@
+Given /^I am not logged in$/ do
+ # do nothing yet
+end
View
2 features/support/paths.rb
@@ -10,6 +10,8 @@ def path_to(page_name)
when /^the home\s?page$/
'/'
+ when /^registration page/
+ '/account/new'
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
View
5 spec/models/account_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Account do
+ pending "add some examples to (or delete) #{__FILE__}"
+end

0 comments on commit 46cb9f0

Please sign in to comment.