-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added account creation and program page tests
- Loading branch information
Showing
10 changed files
with
97 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,5 @@ end | |
group :test do | ||
gem "mocha" | ||
gem "database_cleaner" | ||
gem "launchy" | ||
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
Empty file.
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,16 @@ | ||
Feature: Access Programs | ||
|
||
As a user of the site, I want to access users' programs | ||
|
||
Scenario: View a featured program | ||
Given there is a featured program | ||
Then I should be able to view a highlighted program | ||
|
||
Scenario: View my programs | ||
Given a logged in user | ||
And I have uploaded a program | ||
Then I should be able to view my programs | ||
|
||
Scenario: View another user's programs | ||
Given a user has uploaded a program | ||
Then I should be able to view their programs |
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,7 @@ | ||
Feature: Sign up for an account | ||
|
||
As a new Hackety user, I want to create a new account and log in with it | ||
|
||
Scenario: Create an account via the signup form | ||
When I register a new account | ||
Then I should be logged in with my new account |
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,47 @@ | ||
Given /^there is a featured program$/ do | ||
@program = Program.create!(:author_username => "username", | ||
:slug => "slug", | ||
:title => "My Featured Program", | ||
:featured => true) | ||
end | ||
|
||
Then /^I should be able to view a highlighted program$/ do | ||
visit programs_path | ||
within "#featured" do | ||
page.should have_content("My Featured Program") | ||
end | ||
end | ||
|
||
def upload_program(user) | ||
@program = Program.create!(:author_username => user.username, | ||
:slug => "slug", | ||
:title => "#{user.username}'s program") | ||
end | ||
|
||
Given /^I have uploaded a program$/ do | ||
upload_program(@user) | ||
end | ||
|
||
Given /^a user has uploaded a program$/ do | ||
@user = User.create!(:username => "some_user", | ||
:password => "password", | ||
:password_confirmation => "password", | ||
:email => "some_user@example.com") | ||
upload_program(@user) | ||
end | ||
|
||
def visit_user_programs_page | ||
visit user_path(@user) | ||
within ".about-user" do | ||
find(".user-programs").click() | ||
end | ||
page.should have_content(@program.title.titleize) | ||
end | ||
|
||
Then /^I should be able to view my programs$/ do | ||
visit_user_programs_page | ||
end | ||
|
||
Then /^I should be able to view their programs$/ do | ||
visit_user_programs_page | ||
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,17 @@ | ||
When /^I register a new account$/ do | ||
@user_info = {:username => "username", :password => "password", :email => "test@example.com"} | ||
|
||
visit new_user_registration_path | ||
|
||
fill_in("Username", :with => @user_info[:username]) | ||
fill_in("Email", :with => @user_info[:email]) | ||
fill_in("Password", :with => @user_info[:password]) | ||
fill_in("Password confirmation", :with => @user_info[:password]) | ||
|
||
click_button "Sign up" | ||
end | ||
|
||
When /^I should be logged in with my new account$/ do | ||
page.should have_content("You have signed up successfully") | ||
page.should have_content(@user_info[:username]) | ||
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