debian-mirror-gitlab/features/steps/project/redirects.rb

68 lines
2 KiB
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
step 'public project "Community"' do
create :project, :public, name: 'Community'
end
step 'private project "Enterprise"' do
create :project, name: 'Enterprise'
end
step 'I visit project "Community" page' do
project = Project.find_by(name: 'Community')
2015-04-26 12:48:37 +05:30
visit namespace_project_path(project.namespace, project)
2014-09-02 18:07:02 +05:30
end
step 'I should see project "Community" home page' do
2015-04-26 12:48:37 +05:30
Gitlab.config.gitlab.should_receive(:host).and_return("www.example.com")
2015-09-11 14:41:01 +05:30
page.within '.navbar-gitlab .title' do
expect(page).to have_content 'Community'
2014-09-02 18:07:02 +05:30
end
end
step 'I visit project "Enterprise" page' do
project = Project.find_by(name: 'Enterprise')
2015-04-26 12:48:37 +05:30
visit namespace_project_path(project.namespace, project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project "CommunityDoesNotExist" page' do
project = Project.find_by(name: 'Community')
2015-04-26 12:48:37 +05:30
visit namespace_project_path(project.namespace, project) + 'DoesNotExist'
2014-09-02 18:07:02 +05:30
end
step 'I click on "Sign In"' do
2015-04-26 12:48:37 +05:30
first(:link, "Sign in").click
2014-09-02 18:07:02 +05:30
end
step 'Authenticate' do
admin = create(:admin)
fill_in "user_login", with: admin.email
fill_in "user_password", with: admin.password
click_button "Sign in"
Thread.current[:current_user] = admin
end
step 'I should be redirected to "Community" page' do
project = Project.find_by(name: 'Community')
2015-09-11 14:41:01 +05:30
expect(current_path).to eq "/#{project.path_with_namespace}"
expect(status_code).to eq 200
2014-09-02 18:07:02 +05:30
end
step 'I get redirected to signin page where I sign in' do
admin = create(:admin)
fill_in "user_login", with: admin.email
fill_in "user_password", with: admin.password
click_button "Sign in"
Thread.current[:current_user] = admin
end
step 'I should be redirected to "Enterprise" page' do
project = Project.find_by(name: 'Enterprise')
2015-09-11 14:41:01 +05:30
expect(current_path).to eq "/#{project.path_with_namespace}"
expect(status_code).to eq 200
2014-09-02 18:07:02 +05:30
end
end