2011-12-29 23:33:26 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2011-12-30 14:14:14 +01:00
|
|
|
describe "Projects", "DeployKeys" do
|
2012-11-06 04:31:55 +01:00
|
|
|
let(:project) { create(:project) }
|
2011-12-29 23:33:26 +01:00
|
|
|
|
|
|
|
before do
|
|
|
|
login_as :user
|
2013-01-04 17:50:31 +01:00
|
|
|
project.team << [@user, :master]
|
2011-12-29 23:33:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /keys" do
|
|
|
|
before do
|
2012-11-06 04:31:55 +01:00
|
|
|
@key = create(:key, project: project)
|
2011-12-29 23:33:26 +01:00
|
|
|
visit project_deploy_keys_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
subject { page }
|
|
|
|
|
|
|
|
it { should have_content(@key.title) }
|
|
|
|
|
|
|
|
describe "Destroy" do
|
|
|
|
before { visit project_deploy_key_path(project, @key) }
|
|
|
|
|
|
|
|
it "should remove entry" do
|
|
|
|
expect {
|
|
|
|
click_link "Remove"
|
|
|
|
}.to change { project.deploy_keys.count }.by(-1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-01-19 08:27:23 +01:00
|
|
|
describe "New key" do
|
2011-12-29 23:33:26 +01:00
|
|
|
before do
|
|
|
|
visit project_deploy_keys_path(project)
|
2012-01-14 20:26:35 +01:00
|
|
|
click_link "New Deploy Key"
|
2011-12-29 23:33:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should open new key popup" do
|
2012-01-17 23:46:13 +01:00
|
|
|
page.should have_content("New Deploy key")
|
2011-12-29 23:33:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "fill in" do
|
|
|
|
before do
|
2012-08-11 00:07:50 +02:00
|
|
|
fill_in "key_title", with: "laptop"
|
2012-09-25 15:29:17 +02:00
|
|
|
fill_in "key_key", with: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzrEJUIR6Y03TCE9rIJ+GqTBvgb8t1jI9h5UBzCLuK4VawOmkLornPqLDrGbm6tcwM/wBrrLvVOqi2HwmkKEIecVO0a64A4rIYScVsXIniHRS6w5twyn1MD3sIbN+socBDcaldECQa2u1dI3tnNVcs8wi77fiRe7RSxePsJceGoheRQgC8AZ510UdIlO+9rjIHUdVN7LLyz512auAfYsgx1OfablkQ/XJcdEwDNgi9imI6nAXhmoKUm1IPLT2yKajTIC64AjLOnE0YyCh6+7RFMpiMyu1qiOCpdjYwTgBRiciNRZCH8xIedyCoAmiUgkUT40XYHwLuwiPJICpkAzp7Q== user@laptop"
|
2011-12-29 23:33:26 +01:00
|
|
|
end
|
|
|
|
|
2011-12-31 18:37:51 +01:00
|
|
|
it { expect { click_button "Save" }.to change {Key.count}.by(1) }
|
2011-12-29 23:33:26 +01:00
|
|
|
|
|
|
|
it "should add new key to table" do
|
|
|
|
click_button "Save"
|
|
|
|
|
|
|
|
page.should have_content "laptop"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-08-29 06:58:22 +02:00
|
|
|
describe "Show page" do
|
2011-12-29 23:33:26 +01:00
|
|
|
before do
|
2012-11-06 04:31:55 +01:00
|
|
|
@key = create(:key, project: project)
|
2012-08-29 06:58:22 +02:00
|
|
|
visit project_deploy_key_path(project, @key)
|
2011-12-29 23:33:26 +01:00
|
|
|
end
|
2012-08-29 06:58:22 +02:00
|
|
|
|
2011-12-29 23:33:26 +01:00
|
|
|
it { page.should have_content @key.title }
|
|
|
|
it { page.should have_content @key.key[0..10] }
|
|
|
|
end
|
|
|
|
end
|