summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/key.rb4
-rw-r--r--features/profile/ssh_keys.feature4
-rw-r--r--features/step_definitions/profile/profile_keys_steps.rb2
-rw-r--r--spec/requests/projects_deploy_keys_spec.rb8
4 files changed, 10 insertions, 8 deletions
diff --git a/app/models/key.rb b/app/models/key.rb
index 3890814cecf..a39a4a16c22 100644
--- a/app/models/key.rb
+++ b/app/models/key.rb
@@ -4,13 +4,15 @@ class Key < ActiveRecord::Base
belongs_to :user
belongs_to :project
+ attr_protected :user_id
+
validates :title,
presence: true,
length: { within: 0..255 }
validates :key,
presence: true,
- :format => { :with => /ssh-.{3} / },
+ format: { :with => /ssh-.{3} / },
length: { within: 0..5000 }
before_save :set_identifier
diff --git a/features/profile/ssh_keys.feature b/features/profile/ssh_keys.feature
index c3a92f30ee0..c81503ed2ba 100644
--- a/features/profile/ssh_keys.feature
+++ b/features/profile/ssh_keys.feature
@@ -3,8 +3,8 @@ Feature: SSH Keys
Given I signin as a user
And I have ssh keys:
| title |
- | Work |
- | Home |
+ | ssh-rsa Work |
+ | ssh-rsa Home |
And I visit profile keys page
Scenario: I should see SSH keys
diff --git a/features/step_definitions/profile/profile_keys_steps.rb b/features/step_definitions/profile/profile_keys_steps.rb
index 5ab7e0480ad..25926c53f97 100644
--- a/features/step_definitions/profile/profile_keys_steps.rb
+++ b/features/step_definitions/profile/profile_keys_steps.rb
@@ -16,7 +16,7 @@ end
Given /^I submit new ssh key "(.*?)"$/ do |arg1|
fill_in "key_title", :with => arg1
- fill_in "key_key", :with => "publickey234="
+ fill_in "key_key", :with => "ssh-rsa publickey234="
click_button "Save"
end
diff --git a/spec/requests/projects_deploy_keys_spec.rb b/spec/requests/projects_deploy_keys_spec.rb
index 0fea7b46ce2..894aa6d3a8d 100644
--- a/spec/requests/projects_deploy_keys_spec.rb
+++ b/spec/requests/projects_deploy_keys_spec.rb
@@ -42,7 +42,7 @@ describe "Projects", "DeployKeys" do
describe "fill in" do
before do
fill_in "key_title", with: "laptop"
- fill_in "key_key", with: "publickey234="
+ fill_in "key_key", with: "ssh-rsa publickey234="
end
it { expect { click_button "Save" }.to change {Key.count}.by(1) }
@@ -55,12 +55,12 @@ describe "Projects", "DeployKeys" do
end
end
- describe "Show page" do
+ describe "Show page" do
before do
@key = Factory :key, project: project
- visit project_deploy_key_path(project, @key)
+ 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