Commit 2703fe3e authored by Alex Denisov's avatar Alex Denisov

Merge branch 'master' into issue_status_changed_notifications

parents 05af5655 adc71b6a
...@@ -4,13 +4,15 @@ class Key < ActiveRecord::Base ...@@ -4,13 +4,15 @@ class Key < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :project belongs_to :project
attr_protected :user_id
validates :title, validates :title,
presence: true, presence: true,
length: { within: 0..255 } length: { within: 0..255 }
validates :key, validates :key,
presence: true, presence: true,
:format => { :with => /ssh-.{3} / }, format: { :with => /ssh-.{3} / },
length: { within: 0..5000 } length: { within: 0..5000 }
before_save :set_identifier before_save :set_identifier
......
...@@ -3,8 +3,8 @@ Feature: SSH Keys ...@@ -3,8 +3,8 @@ Feature: SSH Keys
Given I signin as a user Given I signin as a user
And I have ssh keys: And I have ssh keys:
| title | | title |
| Work | | ssh-rsa Work |
| Home | | ssh-rsa Home |
And I visit profile keys page And I visit profile keys page
Scenario: I should see SSH keys Scenario: I should see SSH keys
......
...@@ -16,7 +16,7 @@ end ...@@ -16,7 +16,7 @@ end
Given /^I submit new ssh key "(.*?)"$/ do |arg1| Given /^I submit new ssh key "(.*?)"$/ do |arg1|
fill_in "key_title", :with => arg1 fill_in "key_title", :with => arg1
fill_in "key_key", :with => "publickey234=" fill_in "key_key", :with => "ssh-rsa publickey234="
click_button "Save" click_button "Save"
end end
......
...@@ -42,7 +42,7 @@ describe "Projects", "DeployKeys" do ...@@ -42,7 +42,7 @@ describe "Projects", "DeployKeys" do
describe "fill in" do describe "fill in" do
before do before do
fill_in "key_title", with: "laptop" fill_in "key_title", with: "laptop"
fill_in "key_key", with: "publickey234=" fill_in "key_key", with: "ssh-rsa publickey234="
end end
it { expect { click_button "Save" }.to change {Key.count}.by(1) } it { expect { click_button "Save" }.to change {Key.count}.by(1) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment