Skip to content

Commit

Permalink
fixed typos
Browse files Browse the repository at this point in the history
  • Loading branch information
YogiZoli committed Apr 8, 2012
1 parent 2ed6be5 commit 9f079ee
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/controllers/sessions_controller.rb
@@ -1,2 +1,13 @@
class SessionsController < ApplicationController

def new
end

def create
render 'new'
end

def destroy
end

end
19 changes: 19 additions & 0 deletions app/views/sessions/new.html.erb
@@ -0,0 +1,19 @@
<% provide(:title, "Sign in") %>
<h1>Sign in</h1>

<div class="row">
<div class="span6 offset3">
<%= form_for(:session, :url => sessions_path) do |f| %>
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.label :password %>
<%= f.password_field :password %>
<%= f.submit "Sign in", :class => "btn btn-large btn-primary" %>
<% end %>

<p>New user? <%= link_to "Sign up now!", signup_path %></p>
</div>
</div>
5 changes: 4 additions & 1 deletion config/routes.rb
@@ -1,10 +1,13 @@
Awesomepassion::Application.routes.draw do

resources :users
resources :sessions, only: [:new, :create, :destroy]

root to: 'static_pages#home'

match 'signup', to: 'users#new'
match '/signup', to: 'users#new'
match '/signin', to: 'sessions#new'
match '/signout', to: 'sessions#destroy', via: :delete
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
Expand Down
26 changes: 25 additions & 1 deletion spec/requests/authentication_pages_spec.rb
Expand Up @@ -5,10 +5,34 @@
subject { page }

describe "signin page" do
before { signin_path }
before { visit signin_path }

it { should have_selector('h1', text: 'Sign in') }
it { should have_selector('title', text: 'Sign in') }
end

describe "signin" do
before { visit signin_path }

describe "with invalid info" do
before { click_button "Sign in" }

it { should have_selector('title', text: 'Sign in') }
it { should have_selector('div.alert.alert-error', text: 'Invalid') }
end

describe "with valid info" do
let(:user) { FactoryGirl.create(:user)}
before do
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_button "Sign in"
end

it { should have_selector('title', text: user.name) }
it { should have_link('Profile', href: user_path(user)) }
it { should have_link('Sign out', href: signout_path) }
it { should_not have_link('Sign in', href: signin_path ) }
end
end
end

0 comments on commit 9f079ee

Please sign in to comment.