Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New user feature, including sign up with confirmation e-mail

  • Loading branch information...
commit 4dfc06084cec2065370779ab1b9c3a5784addee9 1 parent 4ce2d1d
Alexandre Prates authored
Showing with 4,367 additions and 299 deletions.
  1. +7 −0 app/controllers/room_controller.rb
  2. +27 −0 app/controllers/user_controller.rb
  3. +10 −0 app/helpers/application_helper.rb
  4. +2 −0  app/helpers/room_helper.rb
  5. +2 −0  app/helpers/user_helper.rb
  6. +64 −0 app/models/user.rb
  7. +14 −0 app/models/user_mailer.rb
  8. +3 −0  app/views/layouts/_user_menu.html.erb
  9. +18 −0 app/views/layouts/application.html.erb
  10. +1 −0  app/views/room/index.html.erb
  11. +73 −0 app/views/user/new.html.erb
  12. +17 −0 app/views/user_mailer/welcome_email.text.html.erb
  13. +4 −23 config/database.yml
  14. +9 −0 config/initializers/mailer.rb
  15. +6 −1 config/routes.rb
  16. +36 −0 db/migrate/20100328065716_create_users.rb
  17. +45 −0 db/schema.rb
  18. +82 −0 features/manage_users.feature
  19. +19 −0 features/step_definitions/user_steps.rb
  20. +3 −0  features/support/paths.rb
  21. +1,744 −0 log/cucumber.log
  22. +2,062 −0 log/development.log
  23. +0 −275 public/index.html
  24. +1 −0  rerun.txt
  25. +10 −0 spec/controllers/room_controller_spec.rb
  26. +10 −0 spec/controllers/user_controller_spec.rb
  27. +39 −0 spec/fixtures/users.yml
  28. +11 −0 spec/helpers/room_helper_spec.rb
  29. +11 −0 spec/helpers/user_helper_spec.rb
  30. +29 −0 spec/models/user_spec.rb
  31. +8 −0 test/unit/user_mailer_test.rb
7 app/controllers/room_controller.rb
View
@@ -0,0 +1,7 @@
+class RoomController < ApplicationController
+
+ def index
+
+ end
+
+end
27 app/controllers/user_controller.rb
View
@@ -0,0 +1,27 @@
+class UserController < ApplicationController
+
+ def new
+ @user = User.new
+ end
+
+ def create
+ @user = User.new(params[:user])
+ if @user.save
+ flash[:notice] = "To complete your registration please follow instructions send to #{@user.email}"
+ redirect_to(:root)
+ else
+ render :action => 'new'
+ end
+ end
+
+ def activate
+ user = User.find_by_activation_key(params[:id])
+ if user and user.activate
+ flash[:notice] = "Congratulations, #{user.display_name} your registration was completed successfully."
+ else
+ flash[:notice] = "Sorry, but this activation key is not valid."
+ end
+ redirect_to(:root)
+ end
+
+end
10 app/helpers/application_helper.rb
View
@@ -1,3 +1,13 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
+
+ def gender_options
+ ['Male', 'Female']
+ end
+
+ def time_zone_options
+ (-11..11).collect { |time| "GMT #{time}:00" }
+ end
+
+
end
2  app/helpers/room_helper.rb
View
@@ -0,0 +1,2 @@
+module RoomHelper
+end
2  app/helpers/user_helper.rb
View
@@ -0,0 +1,2 @@
+module UserHelper
+end
64 app/models/user.rb
View
@@ -0,0 +1,64 @@
+require 'digest/sha2'
+class User < ActiveRecord::Base
+ cattr_accessor :current
+ attr_accessor :password, :accept_terms
+
+ class << self
+
+ def authenticate(authentication_hash = {})
+ user = User.find_by_email(authentication_hash[:email])
+ user if user and user.password_match?(authentication_hash[:password])
+ end
+
+ end
+
+ validates_uniqueness_of :email
+ validates_presence_of :email
+ validates_presence_of :display_name
+ validates_uniqueness_of :display_name
+ validates_confirmation_of :password, :if => :password_changed?
+ validates_acceptance_of :accept_terms
+
+ before_create :generate_activation
+ before_save :generate_password, :if => :password_changed?
+ after_create :send_activation_email
+
+ def password_changed?
+ !password.blank?
+ end
+
+ def password_match?(password)
+ hash = generate_hash(password)
+ password_hash == hash
+ end
+
+ def generate_hash(password)
+ Digest::SHA2.hexdigest(self.password_salt + password)
+ end
+
+ def activate
+ return if Time.now > activation_expires
+ self.activation_key = nil
+ self.activation_expires = nil
+ self.active = true
+ self.save
+ end
+
+ private
+
+ def send_activation_email
+ UserMailer.deliver_welcome_email(self)
+ end
+
+ def generate_activation
+ self.activation_key = ActiveSupport::SecureRandom.base64(40)
+ self.activation_expires = Time.now + 10.days
+ logger.warn(self.activation_key)
+ end
+
+ def generate_password
+ self.password_salt = ActiveSupport::SecureRandom.base64(10)
+ self.password_hash = generate_hash(password)
+ end
+
+end
14 app/models/user_mailer.rb
View
@@ -0,0 +1,14 @@
+class UserMailer < ActionMailer::Base
+
+ def welcome_email(user)
+ recipients user.email
+ from "Memphant users registration"
+ subject "Welcome to Menphant #{user.display_name}"
+ sent_on Time.now
+ body({
+ :user => user,
+ :activation_url => activation_url(user.activation_key, :host => 'localhost', :port => '3000')
+ })
+ end
+
+end
3  app/views/layouts/_user_menu.html.erb
View
@@ -0,0 +1,3 @@
+<div id="user_menu">
+ <%= link_to 'Sign up', new_sign_up_path %>
+</div>
18 app/views/layouts/application.html.erb
View
@@ -0,0 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
+ <title>Memphant: <%= controller.action_name %></title>
+ <%= stylesheet_link_tag 'screen' %>
+ </head>
+ <body>
+ <div id="content">
+ <div id="title">Memphant</div>
+ <%= render :partial => 'layouts/user_menu' %>
+ <p style="color: green"><%= flash[:notice] %></p>
+ <%= yield %>
+ </div>
+ </body>
+</html>
1  app/views/room/index.html.erb
View
@@ -0,0 +1 @@
+<h1>Rooms</h1>
73 app/views/user/new.html.erb
View
@@ -0,0 +1,73 @@
+<% form_for(@user, :url => sign_up_path) do |f| -%>
+ <%= f.error_messages %>
+
+ <fieldset>
+ <%= f.label(:full_name) %>
+ <%= f.text_field(:full_name) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:email) %>
+ <%= f.text_field(:email) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:display_name) %>
+ <%= f.text_field(:display_name) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:password) %>
+ <%= f.text_field(:password) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:password_confirmation) %>
+ <%= f.text_field(:password_confirmation) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:gender) %>
+ <%= f.select(:gender, gender_options) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:birthdate) %>
+ <%= f.text_field(:birthdate) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:city) %>
+ <%= f.text_field(:city) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:state) %>
+ <%= f.text_field(:state) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:country) %>
+ <%= f.text_field(:country) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.label(:time_zone) %>
+ <%= f.select(:time_zone, time_zone_options) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.check_box(:public_profile) %>
+ <%= f.label(:public_profile) %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.check_box(:accept_terms) %>
+ <%= f.label(:accept_terms, 'I accept terms of use') %>
+ </fieldset>
+
+ <fieldset>
+ <%= f.submit('Continue') %>
+ </fieldset>
+
+<% end -%>
17 app/views/user_mailer/welcome_email.text.html.erb
View
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
+ </head>
+ <body>
+ <h1>Welcome to Memphant, <%=h @user.full_name %></h1>
+ <p>To complete your registration by <%= link_to('click here!', @activation_url) %></p>
+ <br/>
+ <p>For sign in:</p>
+ <p>E-mail: <%= @user.email %></p>
+ <p>Password: <%= @user.password %></p>
+ <br/>
+ <br/>
+ <p>Thanks, Memphant tean</p>
+ </body>
+</html>
27 config/database.yml
View
@@ -1,19 +1,3 @@
-# MySQL. Versions 4.1 and 5.0 are recommended.
-#
-# Install the MySQL driver:
-# gem install mysql
-# On Mac OS X:
-# sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
-# On Mac OS X Leopard:
-# sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
-# This sets the ARCHFLAGS environment variable to your native architecture
-# On Windows:
-# gem install mysql
-# Choose the win32 build.
-# Install MySQL and put its /bin directory on your path.
-#
-# And be sure to use new-style password hashing:
-# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql
encoding: utf8
@@ -21,12 +5,9 @@ development:
database: Memphant_development
pool: 5
username: root
- password:
+ password: qwerty
socket: /var/run/mysqld/mysqld.sock
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
test: &TEST
adapter: mysql
encoding: utf8
@@ -34,7 +15,7 @@ test: &TEST
database: Memphant_test
pool: 5
username: root
- password:
+ password: qwerty
socket: /var/run/mysqld/mysqld.sock
production:
@@ -44,8 +25,8 @@ production:
database: Memphant_production
pool: 5
username: root
- password:
+ password: qwerty
socket: /var/run/mysqld/mysqld.sock
cucumber:
- <<: *TEST
+ <<: *TEST
9 config/initializers/mailer.rb
View
@@ -0,0 +1,9 @@
+ActionMailer::Base.smtp_settings = {
+ :address => "smtp.gmail.com",
+ :port => 587,
+ :enable_starttls_auto => true,
+ :domain => "gmail.com",
+ :user_name => "memphant",
+ :password => "m3mph4nt",
+ :authentication => :plain
+}
7 config/routes.rb
View
@@ -1,4 +1,9 @@
ActionController::Routing::Routes.draw do |map|
+# map.sign_up '/user/register', :controller => 'user', :action => 'new'
+# map.register '/user/register'.
+ map.resource 'sign_up', :controller => 'user', :only => [:new, :create]
+ map.activation 'activate/:id', :controller => 'user', :action => 'activate'
+
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
@@ -31,7 +36,7 @@
# end
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
- # map.root :controller => "welcome"
+ map.root :controller => "room"
# See how all your routes lay out with "rake routes"
36 db/migrate/20100328065716_create_users.rb
View
@@ -0,0 +1,36 @@
+class CreateUsers < ActiveRecord::Migration
+ def self.up
+ create_table :users do |t|
+ t.string :full_name, :limit => 100
+ t.string :email, :limit => 100
+ t.string :display_name, :limit => 15
+ t.string :password_salt, :limit => 16
+ t.string :password_hash, :limit => 64
+ t.string :gender, :limit => 20
+ t.date :birthdate
+ t.string :city, :limit => 50
+ t.string :state, :limit => 50
+ t.string :country, :limti => 50
+ t.string :time_zone, :limit => 16
+ t.boolean :public_profile, :default => false
+ t.string :activation_key, :limit => 56
+ t.timestamp :activation_expires
+ t.boolean :active, :default => false
+ t.boolean :admin, :default => false
+ t.boolean :manage_rooms, :default => false
+ t.boolean :manage_messages, :default => false
+ t.boolean :manage_user, :default => false
+ t.string :last_ip, :limit => 15
+ t.timestamp :last_access
+ t.boolean :online, :default => false
+ t.timestamps
+ end
+ add_index(:users, :display_name)
+ add_index(:users, :email)
+ add_index(:users, :activation_key)
+ end
+
+ def self.down
+ drop_table :users
+ end
+end
45 db/schema.rb
View
@@ -0,0 +1,45 @@
+# This file is auto-generated from the current state of the database. Instead of editing this file,
+# please use the migrations feature of Active Record to incrementally modify your database, and
+# then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your database schema. If you need
+# to create the application database on another system, you should be using db:schema:load, not running
+# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20100328065716) do
+
+ create_table "users", :force => true do |t|
+ t.string "full_name", :limit => 100
+ t.string "email", :limit => 100
+ t.string "display_name", :limit => 15
+ t.string "password_salt", :limit => 16
+ t.string "password_hash", :limit => 64
+ t.string "gender", :limit => 20
+ t.date "birthdate"
+ t.string "city", :limit => 50
+ t.string "state", :limit => 50
+ t.string "country"
+ t.string "time_zone", :limit => 16
+ t.boolean "public_profile", :default => false
+ t.string "activation_key", :limit => 56
+ t.datetime "activation_expires"
+ t.boolean "active", :default => false
+ t.boolean "admin", :default => false
+ t.boolean "manage_rooms", :default => false
+ t.boolean "manage_messages", :default => false
+ t.boolean "manage_user", :default => false
+ t.string "last_ip", :limit => 15
+ t.datetime "last_access"
+ t.boolean "online", :default => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "users", ["activation_key"], :name => "index_users_on_activation_key"
+ add_index "users", ["display_name"], :name => "index_users_on_display_name"
+ add_index "users", ["email"], :name => "index_users_on_email"
+
+end
82 features/manage_users.feature
View
@@ -0,0 +1,82 @@
+Feature: Create and manager user and permissions
+ In order to manager access to application contents
+ As guest
+ wants sing up and manage my account
+
+ Scenario: sign up a new user
+ Given I am on the home page
+ And I follow "sign up"
+ And I fill in "Full Name" with "Alexandre Prates"
+ And I fill in "Email" with "ajfprates@gmail.com"
+ And I fill in "Display name" with "Nep"
+ And I fill in "Password" with "secretpass"
+ And I fill in "Password confirmation" with "secretpass"
+ And I select "Male" from "Gender"
+ And I fill in "Birthdate" with "03/09/1978"
+ And I fill in "City" with "Campo Grande"
+ And I fill in "State" with "Mato Grosso do Sul"
+ And I fill in "Country" with "Brasil"
+ And I select "GMT -4:00" from "Time zone"
+ And I check "Public profile"
+ And I check "I accept terms of use"
+ And I press "Continue"
+ Then I should see "To complete your registration please follow instructions send to ajfprates@gmail.com"
+ And I access url in confirmation in "ajfprates@gmail.com"
+ And I should see "Congratulations, Nep your registration was completed successfully."
+
+
+
+# Cenario: Fazer cadastro de novo usuário
+# Dado estando na pagina principal
+# E sigo o link "Cadastro"
+# E preencho "Alexandre Prates" em "Nome completo"
+# E preencho "ajfprates@gmail.com" em "E-mail"
+# E preencho "Nep" em "Nome de exibição"
+# E preencho "senhasecreta" em "Senha"
+# E preencho "senhasecreta" em "Confirmação de senha"
+# E marco o item "Perfil público"
+# E seleciono "Masculino" em "Sexo"
+# E preencho "09/03/1978" em "Nascimento"
+# E preencho "Campo Grande - MS" em "Localidade"
+# E seleciono "GMT -4:00" em "Fuso horário"
+# E marco o item "Aceito os termos de uso"
+# E clico em "Continuar"
+# Entao devo ver "Para concluir seu cadastro siga as instruções enviadas para ajfprates@gmail.com"
+#
+# Cenario: Confirmação de cadastro com link de ativação
+#
+# Dado estando na pagina principal
+#
+# E não estando logado
+#
+# E acesso o link "link_de_ativacao"
+#
+# Então devo ver "Bem vindo Nep, seu cadastro foi completado com sucesso."
+#
+# E devo ver "para se logar use seu e-mail ajfprates@gmail.com juntamente com sua senha cadastrada"
+#
+#
+#
+# Cenario: Tentativa de confirmação com link de ativação expirado
+#
+# Dado estando na pagina principal
+#
+# E não estando logado
+#
+# E acesso o link "link_de_ativacao_expirado"
+#
+# Entao devo ver "Este link de ativação está expirado, faça um novo cadastro."
+#
+# Cenario: Cadastro com usuário válido
+#
+# Dado estando na pagina principal
+#
+# E preencho "ajfprates@gmail.com" em "Identificação"
+#
+# E preencho "senhasecreta" em "Senha"
+#
+# E sigo o link "acessar"
+#
+# Então devo ver "Bem vindo Nep"
+#
+#
19 features/step_definitions/user_steps.rb
View
@@ -0,0 +1,19 @@
+Then /^I access url in confirmation in "([^\"]*)"$/ do |email|
+ user = User.find_by_email(email)
+ visit activation_path(user.activation_key)
+end
+
+Given /^the following users:$/ do |users|
+ User.create!(users.hashes)
+end
+
+When /^I delete the (\d+)(?:st|nd|rd|th) user$/ do |pos|
+ visit users_url
+ within("table tr:nth-child(#{pos.to_i+1})") do
+ click_link "Destroy"
+ end
+end
+
+Then /^I should see the following users:$/ do |expected_users_table|
+ expected_users_table.diff!(tableish('table tr', 'td,th'))
+end
3  features/support/paths.rb
View
@@ -10,6 +10,9 @@ def path_to(page_name)
when /the home\s?page/
'/'
+ when /the new user page/
+ new_user_path
+
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
1,744 log/cucumber.log
View
1,744 additions, 0 deletions not shown
2,062 log/development.log
View
2,062 additions, 0 deletions not shown
275 public/index.html
View
@@ -1,275 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <title>Ruby on Rails: Welcome aboard</title>
- <style type="text/css" media="screen">
- body {
- margin: 0;
- margin-bottom: 25px;
- padding: 0;
- background-color: #f0f0f0;
- font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
- font-size: 13px;
- color: #333;
- }
-
- h1 {
- font-size: 28px;
- color: #000;
- }
-
- a {color: #03c}
- a:hover {
- background-color: #03c;
- color: white;
- text-decoration: none;
- }
-
-
- #page {
- background-color: #f0f0f0;
- width: 750px;
- margin: 0;
- margin-left: auto;
- margin-right: auto;
- }
-
- #content {
- float: left;
- background-color: white;
- border: 3px solid #aaa;
- border-top: none;
- padding: 25px;
- width: 500px;
- }
-
- #sidebar {
- float: right;
- width: 175px;
- }
-
- #footer {
- clear: both;
- }
-
-
- #header, #about, #getting-started {
- padding-left: 75px;
- padding-right: 30px;
- }
-
-
- #header {
- background-image: url("images/rails.png");
- background-repeat: no-repeat;
- background-position: top left;
- height: 64px;
- }
- #header h1, #header h2 {margin: 0}
- #header h2 {
- color: #888;
- font-weight: normal;
- font-size: 16px;
- }
-
-
- #about h3 {
- margin: 0;
- margin-bottom: 10px;
- font-size: 14px;
- }
-
- #about-content {
- background-color: #ffd;
- border: 1px solid #fc0;
- margin-left: -11px;
- }
- #about-content table {
- margin-top: 10px;
- margin-bottom: 10px;
- font-size: 11px;
- border-collapse: collapse;
- }
- #about-content td {
- padding: 10px;
- padding-top: 3px;
- padding-bottom: 3px;
- }
- #about-content td.name {color: #555}
- #about-content td.value {color: #000}
-
- #about-content.failure {
- background-color: #fcc;
- border: 1px solid #f00;
- }
- #about-content.failure p {
- margin: 0;
- padding: 10px;
- }
-
-
- #getting-started {
- border-top: 1px solid #ccc;
- margin-top: 25px;
- padding-top: 15px;
- }
- #getting-started h1 {
- margin: 0;
- font-size: 20px;
- }
- #getting-started h2 {
- margin: 0;
- font-size: 14px;
- font-weight: normal;
- color: #333;
- margin-bottom: 25px;
- }
- #getting-started ol {
- margin-left: 0;
- padding-left: 0;
- }
- #getting-started li {
- font-size: 18px;
- color: #888;
- margin-bottom: 25px;
- }
- #getting-started li h2 {
- margin: 0;
- font-weight: normal;
- font-size: 18px;
- color: #333;
- }
- #getting-started li p {
- color: #555;
- font-size: 13px;
- }
-
-
- #search {
- margin: 0;
- padding-top: 10px;
- padding-bottom: 10px;
- font-size: 11px;
- }
- #search input {
- font-size: 11px;
- margin: 2px;
- }
- #search-text {width: 170px}
-
-
- #sidebar ul {
- margin-left: 0;
- padding-left: 0;
- }
- #sidebar ul h3 {
- margin-top: 25px;
- font-size: 16px;
- padding-bottom: 10px;
- border-bottom: 1px solid #ccc;
- }
- #sidebar li {
- list-style-type: none;
- }
- #sidebar ul.links li {
- margin-bottom: 5px;
- }
-
- </style>
- <script type="text/javascript" src="javascripts/prototype.js"></script>
- <script type="text/javascript" src="javascripts/effects.js"></script>
- <script type="text/javascript">
- function about() {
- if (Element.empty('about-content')) {
- new Ajax.Updater('about-content', 'rails/info/properties', {
- method: 'get',
- onFailure: function() {Element.classNames('about-content').add('failure')},
- onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
- });
- } else {
- new Effect[Element.visible('about-content') ?
- 'BlindUp' : 'BlindDown']('about-content', {duration: 0.25});
- }
- }
-
- window.onload = function() {
- $('search-text').value = '';
- $('search').onsubmit = function() {
- $('search-text').value = 'site:rubyonrails.org ' + $F('search-text');
- }
- }
- </script>
- </head>
- <body>
- <div id="page">
- <div id="sidebar">
- <ul id="sidebar-items">
- <li>
- <form id="search" action="http://www.google.com/search" method="get">
- <input type="hidden" name="hl" value="en" />
- <input type="text" id="search-text" name="q" value="site:rubyonrails.org " />
- <input type="submit" value="Search" /> the Rails site
- </form>
- </li>
-
- <li>
- <h3>Join the community</h3>
- <ul class="links">
- <li><a href="http://www.rubyonrails.org/">Ruby on Rails</a></li>
- <li><a href="http://weblog.rubyonrails.org/">Official weblog</a></li>
- <li><a href="http://wiki.rubyonrails.org/">Wiki</a></li>
- </ul>
- </li>
-
- <li>
- <h3>Browse the documentation</h3>
- <ul class="links">
- <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
- <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
- <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
- <li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
- </ul>
- </li>
- </ul>
- </div>
-
- <div id="content">
- <div id="header">
- <h1>Welcome aboard</h1>
- <h2>You&rsquo;re riding Ruby on Rails!</h2>
- </div>
-
- <div id="about">
- <h3><a href="rails/info/properties" onclick="about(); return false">About your application&rsquo;s environment</a></h3>
- <div id="about-content" style="display: none"></div>
- </div>
-
- <div id="getting-started">
- <h1>Getting started</h1>
- <h2>Here&rsquo;s how to get rolling:</h2>
-
- <ol>
- <li>
- <h2>Use <tt>script/generate</tt> to create your models and controllers</h2>
- <p>To see all available options, run it without parameters.</p>
- </li>
-
- <li>
- <h2>Set up a default route and remove or rename this file</h2>
- <p>Routes are set up in config/routes.rb.</p>
- </li>
-
- <li>
- <h2>Create your database</h2>
- <p>Run <tt>rake db:migrate</tt> to create your database. If you're not using SQLite (the default), edit <tt>config/database.yml</tt> with your username and password.</p>
- </li>
- </ol>
- </div>
- </div>
-
- <div id="footer">&nbsp;</div>
- </div>
- </body>
-</html>
1  rerun.txt
View
@@ -0,0 +1 @@
+
10 spec/controllers/room_controller_spec.rb
View
@@ -0,0 +1,10 @@
+require 'spec_helper'
+
+describe RoomController do
+
+ #Delete this example and add some real ones
+ it "should use RoomController" do
+ controller.should be_an_instance_of(RoomController)
+ end
+
+end
10 spec/controllers/user_controller_spec.rb
View
@@ -0,0 +1,10 @@
+require 'spec_helper'
+
+describe UserController do
+
+ #Delete this example and add some real ones
+ it "should use UserController" do
+ controller.should be_an_instance_of(UserController)
+ end
+
+end
39 spec/fixtures/users.yml
View
@@ -0,0 +1,39 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+ full_name: MyString
+ email: MyString
+ name: MyString
+ password_salt: MyString
+ password_hash: MyString
+ gender: MyString
+ birthdate: 2010-03-28
+ city: MyString
+ state: MyString
+ country: MyString
+ time_zone: MyString
+ public_profile: false
+ activation_key: MyString
+ admin: false
+ manage_rooms: false
+ manage_messages: false
+ manage_user: false
+
+two:
+ full_name: MyString
+ email: MyString
+ name: MyString
+ password_salt: MyString
+ password_hash: MyString
+ gender: MyString
+ birthdate: 2010-03-28
+ city: MyString
+ state: MyString
+ country: MyString
+ time_zone: MyString
+ public_profile: false
+ activation_key: MyString
+ admin: false
+ manage_rooms: false
+ manage_messages: false
+ manage_user: false
11 spec/helpers/room_helper_spec.rb
View
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe RoomHelper do
+
+ #Delete this example and add some real ones or delete this file
+ it "should be included in the object returned by #helper" do
+ included_modules = (class << helper; self; end).send :included_modules
+ included_modules.should include(RoomHelper)
+ end
+
+end
11 spec/helpers/user_helper_spec.rb
View
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe UserHelper do
+
+ #Delete this example and add some real ones or delete this file
+ it "should be included in the object returned by #helper" do
+ included_modules = (class << helper; self; end).send :included_modules
+ included_modules.should include(UserHelper)
+ end
+
+end
29 spec/models/user_spec.rb
View
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe User do
+ before(:each) do
+ @valid_attributes = {
+ :full_name => "value for full_name",
+ :email => "value for email",
+ :name => "value for name",
+ :password_salt => "value for password_salt",
+ :password_hash => "value for password_hash",
+ :gender => "value for gender",
+ :birthdate => Date.today,
+ :city => "value for city",
+ :state => "value for state",
+ :country => "value for country",
+ :time_zone => "value for time_zone",
+ :public_profile => false,
+ :activation_key => "value for activation_key",
+ :admin => false,
+ :manage_rooms => false,
+ :manage_messages => false,
+ :manage_user => false
+ }
+ end
+
+ it "should create a new instance given valid attributes" do
+ User.create!(@valid_attributes)
+ end
+end
8 test/unit/user_mailer_test.rb
View
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class UserMailerTest < ActionMailer::TestCase
+ # replace this with your real tests
+ test "the truth" do
+ assert true
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.