-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test management of projects and collaboration
- Loading branch information
1 parent
32ebfe7
commit 36abecb
Showing
5 changed files
with
127 additions
and
12 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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
.btn-group | ||
- if can? :edit, project | ||
= link_to(edit_project_path(@episode, project), :title=>'Edit this project?', :class=> "btn btn-default") do | ||
= link_to(edit_project_path(@episode, project), :title=>'Edit this project?', :class=> "btn btn-default", id: "project#{project.to_param}-edit-link") do | ||
%i.fa.fa-pencil | ||
- if project.may_advance? | ||
- case project.aasm_state | ||
- when "project" | ||
=link_to(advance_project_path(@episode, project), :method => :post,:title=>'Finish this project', :class=> "btn btn-default") do | ||
=link_to(advance_project_path(@episode, project), :method => :post,:title=>'Finish this project', :class=> "btn btn-default", id: "project#{project.to_param}-advance-link") do | ||
%i.fa.fa-check | ||
- when "record" | ||
=link_to(advance_project_path(@episode, project), :method => :post,:title=>'Revive this project', :class=> "btn btn-default") do | ||
=link_to(advance_project_path(@episode, project), :method => :post,:title=>'Revive this project', :class=> "btn btn-default", id: "project#{project.to_param}-advance-link") do | ||
%i.fa.fa-bolt | ||
- if project.may_recess? | ||
- case project.aasm_state | ||
- when "idea" | ||
=link_to(recess_project_path(@episode, project), :method => :post,:title=>'Archive this project', :class=> "btn btn-default") do | ||
=link_to(recess_project_path(@episode, project), :method => :post,:title=>'Archive this project', :class=> "btn btn-default", id: "project#{project.to_param}-recess-link") do | ||
%i.fa.fa-archive | ||
- when "invention" | ||
=link_to(recess_project_path(@episode, project), :method => :post,:title=>"Restart this project", :class=> "btn btn-default") do | ||
=link_to(recess_project_path(@episode, project), :method => :post,:title=>"Restart this project", :class=> "btn btn-default", id: "project#{project.to_param}-recess-link") do | ||
%i.fa.fa-lightbulb-o | ||
-if can? :destroy, project | ||
= link_to(project_path(@episode, project), :title=>'Delete this project?', :class=> "btn btn-default", :method => :delete, data: { confirm: "Are you sure you want to delete this project? This can't be undone!" }) do | ||
= link_to(project_path(@episode, project), :title=>'Delete this project?', :class=> "btn btn-default", id: "project#{project.to_param}-delete-link", :method => :delete, data: { confirm: "Are you sure you want to delete this project? This can't be undone!" }) do | ||
%i.fa.fa-trash-o |
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,14 +1,56 @@ | ||
require 'rails_helper' | ||
|
||
feature "Collaboration" do | ||
scenario "User creates a new project" do | ||
project = create(:idea) | ||
scenario "User joins a project" do | ||
user = create(:user) | ||
project = create(:idea) | ||
sign_in user | ||
|
||
visit "/projects/#{project.to_param}" | ||
|
||
click_link "Join this project" | ||
expect { | ||
click_link "Join this project" | ||
}.to change(Project.populated, :count).by(1) | ||
expect(page).to have_css("#user#{user.id}-gravatar") | ||
expect(page).to have_text("Welcome to the project #{user.name}!") | ||
end | ||
|
||
scenario "User leaves a project" do | ||
user = create(:user) | ||
project = create(:project, users: [user]) | ||
sign_in user | ||
|
||
visit "/projects/#{project.to_param}" | ||
click_link "Leave this project" | ||
|
||
expect(page).not_to have_css("#user#{user.id}-gravatar") | ||
end | ||
|
||
scenario "User likes a project" do | ||
user = create(:user) | ||
project = create(:idea) | ||
sign_in user | ||
|
||
visit "/projects/#{project.to_param}" | ||
|
||
expect { | ||
click_link "like-#{project.to_param}" | ||
}.to change(Project.liked, :count).by(1) | ||
expect(page).not_to have_css("like-#{project.to_param}") | ||
end | ||
|
||
scenario "User dislikes a project" do | ||
user = create(:user) | ||
project = create(:idea) | ||
sign_in user | ||
|
||
visit "/projects/#{project.to_param}" | ||
click_link "like-#{project.to_param}" | ||
|
||
expect { | ||
click_link "dislike-#{project.to_param}" | ||
}.to change(Project.liked, :count).by(-1) | ||
expect(page).not_to have_css("dislike-#{project.to_param}") | ||
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