Commit 2703fe3e72f0084139a76c5a8332f9402cae0cf1

Authored by Alex Denisov
2 parents 05af5655 adc71b6a

Merge branch 'master' into issue_status_changed_notifications

app/models/key.rb
... ... @@ -4,13 +4,15 @@ class Key < ActiveRecord::Base
4 4 belongs_to :user
5 5 belongs_to :project
6 6  
  7 + attr_protected :user_id
  8 +
7 9 validates :title,
8 10 presence: true,
9 11 length: { within: 0..255 }
10 12  
11 13 validates :key,
12 14 presence: true,
13   - :format => { :with => /ssh-.{3} / },
  15 + format: { :with => /ssh-.{3} / },
14 16 length: { within: 0..5000 }
15 17  
16 18 before_save :set_identifier
... ...
features/profile/ssh_keys.feature
... ... @@ -3,8 +3,8 @@ Feature: SSH Keys
3 3 Given I signin as a user
4 4 And I have ssh keys:
5 5 | title |
6   - | Work |
7   - | Home |
  6 + | ssh-rsa Work |
  7 + | ssh-rsa Home |
8 8 And I visit profile keys page
9 9  
10 10 Scenario: I should see SSH keys
... ...
features/step_definitions/profile/profile_keys_steps.rb
... ... @@ -16,7 +16,7 @@ end
16 16  
17 17 Given /^I submit new ssh key "(.*?)"$/ do |arg1|
18 18 fill_in "key_title", :with => arg1
19   - fill_in "key_key", :with => "publickey234="
  19 + fill_in "key_key", :with => "ssh-rsa publickey234="
20 20 click_button "Save"
21 21 end
22 22  
... ...
spec/requests/projects_deploy_keys_spec.rb
... ... @@ -42,7 +42,7 @@ describe "Projects", "DeployKeys" do
42 42 describe "fill in" do
43 43 before do
44 44 fill_in "key_title", with: "laptop"
45   - fill_in "key_key", with: "publickey234="
  45 + fill_in "key_key", with: "ssh-rsa publickey234="
46 46 end
47 47  
48 48 it { expect { click_button "Save" }.to change {Key.count}.by(1) }
... ... @@ -55,12 +55,12 @@ describe "Projects", "DeployKeys" do
55 55 end
56 56 end
57 57  
58   - describe "Show page" do
  58 + describe "Show page" do
59 59 before do
60 60 @key = Factory :key, project: project
61   - visit project_deploy_key_path(project, @key)
  61 + visit project_deploy_key_path(project, @key)
62 62 end
63   -
  63 +
64 64 it { page.should have_content @key.title }
65 65 it { page.should have_content @key.key[0..10] }
66 66 end
... ...