gitlab-org--gitlab-foss/spec/requests/projects_deploy_keys_spec.rb

68 lines
1.5 KiB
Ruby
Raw Normal View History

2011-12-29 17:33:26 -05:00
require 'spec_helper'
2011-12-30 08:14:14 -05:00
describe "Projects", "DeployKeys" do
2011-12-29 17:33:26 -05:00
let(:project) { Factory :project }
before do
login_as :user
project.add_access(@user, :read, :write, :admin)
end
describe "GET /keys" do
before do
2011-12-31 12:37:51 -05:00
@key = Factory :key, :project => project
2011-12-29 17:33:26 -05: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
describe "New key" do
2011-12-29 17:33:26 -05:00
before do
visit project_deploy_keys_path(project)
click_link "New Deploy Key"
2011-12-29 17:33:26 -05:00
end
it "should open new key popup" do
2012-01-17 17:46:13 -05:00
page.should have_content("New Deploy key")
2011-12-29 17:33:26 -05:00
end
describe "fill in" do
before do
2011-12-31 12:37:51 -05:00
fill_in "key_title", :with => "laptop"
fill_in "key_key", :with => "publickey234="
2011-12-29 17:33:26 -05:00
end
2011-12-31 12:37:51 -05:00
it { expect { click_button "Save" }.to change {Key.count}.by(1) }
2011-12-29 17:33:26 -05:00
it "should add new key to table" do
click_button "Save"
page.should have_content "laptop"
end
end
end
describe "Show page" do
before do
2011-12-31 12:37:51 -05:00
@key = Factory :key, :project => project
2011-12-29 17:33:26 -05:00
visit project_deploy_key_path(project, @key)
end
it { page.should have_content @key.title }
it { page.should have_content @key.key[0..10] }
end
end