2012-09-10 10:51:02 +02:00
|
|
|
class Dashboard < Spinach::FeatureSteps
|
2012-09-10 17:35:03 +02:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
2013-01-09 06:14:05 +01:00
|
|
|
include SharedProject
|
2012-09-10 17:35:03 +02:00
|
|
|
|
2012-09-10 10:51:02 +02:00
|
|
|
Then 'I should see "New Project" link' do
|
|
|
|
page.should have_link "New Project"
|
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I should see "Shop" project link' do
|
|
|
|
page.should have_link "Shop"
|
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I should see last push widget' do
|
2012-10-22 22:37:50 +02:00
|
|
|
page.should have_content "You pushed to new_design"
|
2012-09-10 10:51:02 +02:00
|
|
|
page.should have_link "Create Merge Request"
|
|
|
|
end
|
|
|
|
|
|
|
|
And 'I click "Create Merge Request" link' do
|
|
|
|
click_link "Create Merge Request"
|
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I see prefilled new Merge Request page' do
|
|
|
|
current_path.should == new_project_merge_request_path(@project)
|
|
|
|
find("#merge_request_source_branch").value.should == "new_design"
|
|
|
|
find("#merge_request_target_branch").value.should == "master"
|
|
|
|
find("#merge_request_title").value.should == "New Design"
|
|
|
|
end
|
|
|
|
|
|
|
|
Given 'user with name "John Doe" joined project "Shop"' do
|
2012-11-06 04:31:55 +01:00
|
|
|
user = create(:user, {name: "John Doe"})
|
2012-09-10 10:51:02 +02:00
|
|
|
project = Project.find_by_name "Shop"
|
|
|
|
Event.create(
|
|
|
|
project: project,
|
|
|
|
author_id: user.id,
|
2013-02-13 12:48:16 +01:00
|
|
|
action: Event::JOINED
|
2012-09-10 10:51:02 +02:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2012-10-02 11:27:21 +02:00
|
|
|
Then 'I should see "John Doe joined project at Shop" event' do
|
|
|
|
page.should have_content "John Doe joined project at Shop"
|
2012-09-10 10:51:02 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
And 'user with name "John Doe" left project "Shop"' do
|
|
|
|
user = User.find_by_name "John Doe"
|
|
|
|
project = Project.find_by_name "Shop"
|
|
|
|
Event.create(
|
|
|
|
project: project,
|
|
|
|
author_id: user.id,
|
2013-02-13 12:48:16 +01:00
|
|
|
action: Event::LEFT
|
2012-09-10 10:51:02 +02:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2012-10-02 11:27:21 +02:00
|
|
|
Then 'I should see "John Doe left project at Shop" event' do
|
|
|
|
page.should have_content "John Doe left project at Shop"
|
2012-09-10 10:51:02 +02:00
|
|
|
end
|
|
|
|
|
2012-10-03 22:46:55 +02:00
|
|
|
And 'I have group with projects' do
|
2012-11-06 04:31:55 +01:00
|
|
|
@group = create(:group)
|
|
|
|
@project = create(:project, group: @group)
|
|
|
|
@event = create(:closed_issue_event, project: @project)
|
2012-10-03 22:46:55 +02:00
|
|
|
|
2013-01-04 07:43:25 +01:00
|
|
|
@project.team << [current_user, :master]
|
2012-10-03 22:46:55 +02:00
|
|
|
end
|
|
|
|
|
2013-01-27 14:41:35 +01:00
|
|
|
Then 'I should see projects list' do
|
|
|
|
@user.authorized_projects.all.each do |project|
|
|
|
|
page.should have_link project.name_with_namespace
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-10-03 22:46:55 +02:00
|
|
|
Then 'I should see groups list' do
|
|
|
|
Group.all.each do |group|
|
|
|
|
page.should have_link group.name
|
|
|
|
end
|
|
|
|
end
|
2012-11-28 18:59:19 +01:00
|
|
|
|
|
|
|
And 'group has a projects that does not belongs to me' do
|
|
|
|
@forbidden_project1 = create(:project, group: @group)
|
|
|
|
@forbidden_project2 = create(:project, group: @group)
|
|
|
|
end
|
|
|
|
|
|
|
|
Then 'I should see 1 project at group list' do
|
|
|
|
page.find('span.last_activity/span').should have_content('1')
|
|
|
|
end
|
2012-09-10 10:51:02 +02:00
|
|
|
end
|