diff --git a/spec/factories.rb b/spec/factories.rb index b96afe2cca0..15e54ed2120 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -56,11 +56,6 @@ Factory.add(:key, Key) do |obj| obj.key = File.read(File.join(Rails.root, "db", "pkey.example")) end -Factory.add(:deploy_key, DeployKey) do |obj| - obj.title = "Example key" - obj.key = File.read(File.join(Rails.root, "db", "pkey.example")) -end - Factory.add(:web_hook, WebHook) do |obj| obj.url = Faker::Internet.url end diff --git a/spec/models/deploy_key_spec.rb b/spec/models/deploy_key_spec.rb deleted file mode 100644 index 2c9641aeffd..00000000000 --- a/spec/models/deploy_key_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require 'spec_helper' - -describe DeployKey do - describe "Associations" do - it { should belong_to(:project) } - end - - describe "Validation" do - it { should validate_presence_of(:title) } - it { should validate_presence_of(:key) } - end - - it { Factory.create(:deploy_key, - :project => Factory(:project)).should be_valid } -end -# == Schema Information -# -# Table name: deploy_keys -# -# id :integer not null, primary key -# project_id :integer not null -# created_at :datetime -# updated_at :datetime -# key :text -# title :string(255) -# identifier :string(255) -# - - diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index 6522b825e14..dec0b9961a3 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Key do describe "Associations" do - it { should belong_to(:user) } + it { should belong_to(:user) or belong_to(:project) } end describe "Validation" do diff --git a/spec/monkeypatch.rb b/spec/monkeypatch.rb index 5ad86df25fe..75099e0553a 100644 --- a/spec/monkeypatch.rb +++ b/spec/monkeypatch.rb @@ -24,16 +24,6 @@ class Key end end -class DeployKey - def update_repository - true - end - - def repository_delete_key - true - end -end - class UsersProject def update_repository true diff --git a/spec/requests/projects_deploy_keys_spec.rb b/spec/requests/projects_deploy_keys_spec.rb index 29a1aefde56..8099124457f 100644 --- a/spec/requests/projects_deploy_keys_spec.rb +++ b/spec/requests/projects_deploy_keys_spec.rb @@ -10,7 +10,7 @@ describe "Projects", "DeployKeys" do describe "GET /keys" do before do - @key = Factory :deploy_key, :project => project + @key = Factory :key, :project => project visit project_deploy_keys_path(project) end @@ -41,11 +41,11 @@ describe "Projects", "DeployKeys" do describe "fill in" do before do - fill_in "deploy_key_title", :with => "laptop" - fill_in "deploy_key_key", :with => "publickey234=" + fill_in "key_title", :with => "laptop" + fill_in "key_key", :with => "publickey234=" end - it { expect { click_button "Save" }.to change {DeployKey.count}.by(1) } + it { expect { click_button "Save" }.to change {Key.count}.by(1) } it "should add new key to table" do click_button "Save" @@ -58,7 +58,7 @@ describe "Projects", "DeployKeys" do describe "Show page" do before do - @key = Factory :deploy_key, :project => project + @key = Factory :key, :project => project visit project_deploy_key_path(project, @key) end