-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
agregar pruebas de usuario,close #16
- Loading branch information
Showing
7 changed files
with
134 additions
and
148 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FactoryGirl.define do | ||
sequence :email do |n| | ||
"email-#{n}@factory.com" | ||
end | ||
|
||
factory :user do | ||
password "pa5sword" | ||
password_confirmation { "pa5sword"} | ||
admin true | ||
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 |
---|---|---|
|
@@ -20,7 +20,17 @@ | |
require 'spec_helper' | ||
|
||
describe User do | ||
subject { user } | ||
|
||
before do | ||
@user = User.new(email: "[email protected]", password: "pa5sword", password_confirmation: "pa5sword") | ||
end | ||
|
||
subject { @user } | ||
|
||
it { should respond_to(:admin)} | ||
it { should respond_to(:email) } | ||
it { should respond_to(:password)} | ||
it { should respond_to(:password_confirmation)} | ||
|
||
|
||
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 |
---|---|---|
@@ -1,11 +1,26 @@ | ||
require 'spec_helper' | ||
include Warden::Test::Helpers | ||
|
||
describe "Users" do | ||
describe "GET /users" do | ||
it "works! (now write some real specs)" do | ||
describe "GET /users without being logged in" do | ||
it "should redirect to homepage" do | ||
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers | ||
get users_path | ||
response.status.should be(200) | ||
response.status.should be(302) | ||
end | ||
end | ||
|
||
describe "GET /users with an admin user" do | ||
before do | ||
@user = FactoryGirl.create(:user) | ||
@user.admin = true | ||
login_as @user | ||
@user.save | ||
end | ||
it "should get user index" do | ||
get users_path | ||
response.status.should be | ||
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
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