-
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
6 changed files
with
67 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h1>All users</h1> | ||
|
||
<ul class="users"> | ||
<% @users.each do |user| %> | ||
<li> | ||
<%= gravatar_for user, :size => 30 %> | ||
<%= link_to user.name, user %> | ||
</li> | ||
<% end %> | ||
</ul> |
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 |
---|---|---|
|
@@ -3,6 +3,42 @@ | |
describe UsersController do | ||
render_views | ||
|
||
describe "GET 'index'" do | ||
|
||
describe "for non-signed-in users" do | ||
it "should deny access" do | ||
get :index | ||
response.should redirect_to(signin_path) | ||
end | ||
end | ||
|
||
describe "for signed-in-users" do | ||
|
||
before(:each) do | ||
@user = test_sign_in(Factory(:user)) | ||
Factory(:user, :email => "[email protected]") | ||
Factory(:user, :email => "[email protected]") | ||
end | ||
|
||
it "should be successful" do | ||
get :index | ||
response.should be_success | ||
end | ||
|
||
it "should have the right title" do | ||
get :index | ||
response.should have_selector('title', :content => "All users") | ||
end | ||
|
||
it "should have an element for each user" do | ||
get :index | ||
User.all.each do |user| | ||
response.should have_selector('li', :content => user.name) | ||
end | ||
end | ||
end | ||
end | ||
|
||
describe "GET 'show'" do | ||
|
||
before(:each) do | ||
|
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