-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
22 changed files
with
4,220 additions
and
74 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
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
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
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
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,9 @@ | ||
class AddUsernameToUsers < ActiveRecord::Migration | ||
def self.up | ||
add_column :users, :username, :string | ||
end | ||
|
||
def self.down | ||
remove_column :users, :username | ||
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
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 |
---|---|---|
|
@@ -13,15 +13,18 @@ end | |
|
||
def make_users | ||
admin = User.create!(:name => "Romel Campbell", | ||
:username => "desertfox", | ||
:email => "[email protected]", | ||
:password => "foobar", | ||
:passowrd_conformation => "foobar") | ||
admin.toggle!(:admin) | ||
99.times do |n| | ||
name = Faker::Name.name | ||
username = "person-#{n+1}" | ||
email = "example-#{n+1}@railstutorial.org" | ||
password = "password" | ||
User.create!(:name => name, | ||
:username => username, | ||
:email => email, | ||
:password => password, | ||
:password_confirmation => password) | ||
|
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
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 |
---|---|---|
|
@@ -18,11 +18,9 @@ | |
|
||
before(:each) do | ||
@user = test_sign_in(Factory(:user)) | ||
Factory(:user,:email => "[email protected]") | ||
Factory(:user,:email => "[email protected]") | ||
|
||
30.times do | ||
Factory(:user,:email => Factory.next(:email) ) | ||
Factory(:user, :username => Factory.next(:username),:email => Factory.next(:email) ) | ||
end | ||
end | ||
|
||
|
@@ -104,12 +102,12 @@ | |
|
||
it "should have the users name" do | ||
get :show, :id => @user | ||
response.should have_selector("h1", :content => @user.name) | ||
response.should have_selector("td", :content => @user.name) | ||
end | ||
|
||
it "should have a profile image" do | ||
get :show, :id => @user | ||
response.should have_selector("h1>img", :class => "gravatar") | ||
response.should have_selector("td>img", :class => "gravatar") | ||
end | ||
|
||
it "should have the right URL" do | ||
|
@@ -141,7 +139,7 @@ | |
describe "when signed in as another user" do | ||
|
||
it "should be successfull" do | ||
test_sign_in(Factory(:user, :email => Factory.next(:email))) | ||
test_sign_in(Factory(:user, :username => Factory.next(:username), :email => Factory.next(:email))) | ||
get :show, :id => @user | ||
response.should be_success | ||
end | ||
|
@@ -189,7 +187,8 @@ | |
describe "failure" do | ||
|
||
before(:each) do | ||
@attr = { :name => "", | ||
@attr = {:name => "", | ||
:username => "", | ||
:email => "", | ||
:password => "", | ||
:password_confirmation => "" | ||
|
@@ -218,7 +217,8 @@ | |
describe "Success" do | ||
|
||
before(:each) do | ||
@attr = {:name => "Romel Campbell", | ||
@attr = {:name => "Romel Campbell", | ||
:username => "desertfox", | ||
:email => "[email protected]", | ||
:password => "foobar", | ||
:password_confirmation => "foobar" | ||
|
@@ -363,7 +363,7 @@ | |
|
||
describe "for signed-in users" do | ||
before(:each) do | ||
wrong_user = Factory(:user,:email => "[email protected]") | ||
wrong_user = Factory(:user, :username => Factory.next(:username),:email => "[email protected]") | ||
test_sign_in(wrong_user) | ||
end | ||
|
||
|
@@ -406,7 +406,7 @@ | |
describe "as a admin user" do | ||
|
||
before(:each) do | ||
@admin = Factory(:user, :email => "[email protected]" , :admin => true) | ||
@admin = Factory(:user, :username => Factory.next(:username), :email => "[email protected]" , :admin => true) | ||
test_sign_in(@admin) | ||
end | ||
|
||
|
@@ -452,7 +452,7 @@ | |
|
||
before(:each) do | ||
@user = test_sign_in(Factory(:user)) | ||
@other_user = Factory(:user,:email => Factory.next(:email)) | ||
@other_user = Factory(:user, :username => Factory.next(:username),:email => Factory.next(:email)) | ||
@user.follow!(@other_user) | ||
end | ||
|
||
|
Oops, something went wrong.