-
Notifications
You must be signed in to change notification settings - Fork 19
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
319 additions
and
33 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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
FactoryGirl.define do | ||
|
||
factory :user do | ||
username { Forgery(:internet).email_address } | ||
password { Forgery(:basic).encrypt } | ||
salt { Forgery(:basic).encrypt } | ||
token { Forgery(:basic).encrypt } | ||
username { Forgery::Internet.email_address } | ||
password { Forgery::Basic.encrypt } | ||
salt { Forgery::Basic.encrypt } | ||
token { Forgery::Basic.encrypt } | ||
end | ||
|
||
factory :vote do | ||
user Forgery(:internet).email_address | ||
story_id Forgery(:basic).number(at_least: 1, at_most: 20) | ||
vote Forgery(:basic).number(at_least: 1, at_most: 5) | ||
user Forgery::Internet.email_address | ||
story_id Forgery::Basic.number(at_least: 1, at_most: 20) | ||
vote Forgery::Basic.number(at_least: 1, at_most: 5) | ||
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,34 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Dashboard::Projects' do | ||
before { skip_authentication(DashboardController) } | ||
|
||
context 'empty' do | ||
before do | ||
stub_projects | ||
visit root_path | ||
end | ||
|
||
specify { page.should have_content t('dashboard.empty.title') } | ||
specify { page.should have_content t('dashboard.empty.subtitle') } | ||
end | ||
|
||
context 'projects' do | ||
let(:projects) { (1..5).map { |i| init_object(project_params) }} | ||
let(:project) { projects.first } | ||
|
||
before do | ||
stub_projects(projects) | ||
stub_stories(project) | ||
visit root_path | ||
end | ||
|
||
specify { project_nodes.size.should eq 5} | ||
specify { story_nodes.size.should eq 10} | ||
specify { page.should have_content project.name } | ||
specify { page.should have_content project.velocity_scheme } | ||
specify { page.should have_content project.labels.split(',').join(', ') } | ||
specify { page.should have_content project.point_scale.split(',').join(', ') } | ||
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,40 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Sessions::Exceptions' do | ||
let(:user) { FactoryGirl.create(:user) } | ||
|
||
context 'unauthenticated' do | ||
before { visit root_path } | ||
|
||
specify { current_path.should eq login_path } | ||
specify { page.should have_content t('flashes.sessions.expired') } | ||
end | ||
|
||
context 'no token' do | ||
before do | ||
PivotalTracker::Client.stubs(:token).raises( | ||
PivotalTracker::Client::NoToken | ||
) | ||
|
||
login | ||
end | ||
|
||
specify { page.should have_content t('flashes.sessions.token') } | ||
end | ||
|
||
context 'rest client unauthorized' do | ||
before do | ||
skip_authentication(DashboardController) | ||
|
||
PivotalTracker::Project.stubs(:all).raises( | ||
RestClient::Unauthorized | ||
) | ||
|
||
visit root_path | ||
end | ||
|
||
specify { current_path.should eq login_path } | ||
specify { page.should have_content t('flashes.sessions.unauthorized') } | ||
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,30 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Sessions::Login' do | ||
let(:user) { FactoryGirl.create(:user) } | ||
|
||
context 'success' do | ||
before do | ||
stub_user(user) | ||
stub_projects | ||
login | ||
end | ||
|
||
specify { page.should have_content t('flashes.sessions.success') } | ||
end | ||
|
||
context 'failure' do | ||
before do | ||
stub_user | ||
stub_projects | ||
end | ||
|
||
context 'login' do | ||
before { login } | ||
|
||
specify { current_path.should eq login_path } | ||
specify { page.should have_content t('flashes.sessions.failed') } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Sessions::Logout' do | ||
before { skip_authentication(DashboardController) } | ||
|
||
context 'success' do | ||
before do | ||
stub_projects | ||
visit root_path | ||
logout | ||
end | ||
|
||
specify { page.should have_content t('flashes.sessions.destroy') } | ||
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
Oops, something went wrong.