-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
299bcd6
commit 1ba1b5d
Showing
9 changed files
with
57 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class HomeController < ApplicationController | ||
before_filter :authenticate_user! | ||
|
||
def index | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
%h1 Home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
# This file should contain all the record creation needed to seed the database with its default values. | ||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). | ||
# | ||
# Examples: | ||
# | ||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) | ||
# Mayor.create(name: 'Emanuel', city: cities.first) | ||
#empty all collections# | ||
[User].each &:destroy_all | ||
|
||
#users# | ||
admin = User.create! :email => 'admin@mailinator.com', :password => 'please', :password_confirmation => 'please' | ||
admin.confirm! | ||
user = User.create! :email => 'user@mailinator.com', :password => 'please', :password_confirmation => 'please' | ||
user.confirm! |
2 changes: 1 addition & 1 deletion
2
spec/controllers/project_controller_spec.rb → spec/controllers/projects_controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Factory.define :admin, :class => :user do |user| | ||
user.email 'admin@mailinator.com' | ||
user.password 'please' | ||
user.password_confirmation 'please' | ||
#user.role 'admin' | ||
end | ||
|
||
Factory.define :user do |user| | ||
user.email 'user@mailinator.com' | ||
user.password 'please' | ||
user.password_confirmation 'please' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'spec_helper' | ||
|
||
describe "Authentication" do | ||
describe "SignIn" do | ||
|
||
it "should redirect to sign_in page when user is not logged in" do | ||
visit root_path | ||
page.should have_content("You need to sign in or sign up before continuing.") | ||
end | ||
|
||
it "should render home page when login is successful" do | ||
@admin = Factory(:admin) | ||
@admin.confirm! | ||
visit new_user_session_path | ||
fill_in "Email", with: @admin.email | ||
fill_in "Password", with: 'please' | ||
click_button "Sign in" | ||
|
||
page.should have_content "Signed in successfully." | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters