[refs #441] Remove unused files. Add mass assigment specs
This commit is contained in:
parent
a5af7d72d9
commit
3a183e0dc3
|
@ -1,3 +0,0 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the Platforms::KeyPairs controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,2 +0,0 @@
|
|||
module Platforms::KeyPairsHelper
|
||||
end
|
|
@ -23,11 +23,7 @@ class KeyPair < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def rm_key_call
|
||||
if BuildServer.rm_repository_key(repository.platform_id, repository_id) == 0
|
||||
self.destroy
|
||||
return true
|
||||
end
|
||||
|
||||
return self.destroy if BuildServer.rm_repository_key(repository.platform_id, repository_id) == 0
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,6 +35,8 @@ class User < ActiveRecord::Base
|
|||
has_many :own_groups, :foreign_key => :owner_id, :class_name => 'Group', :dependent => :destroy
|
||||
has_many :own_platforms, :as => :owner, :class_name => 'Platform', :dependent => :destroy
|
||||
|
||||
has_many :key_pairs
|
||||
|
||||
validates :uname, :presence => true, :uniqueness => {:case_sensitive => false}, :format => {:with => /^[a-z0-9_]+$/}, :reserved_name => true
|
||||
validate { errors.add(:uname, :taken) if Group.by_uname(uname).present? }
|
||||
validates :role, :inclusion => {:in => ROLES}, :allow_blank => true
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Platforms::KeyPairsHelper. For example:
|
||||
#
|
||||
# describe Platforms::KeyPairsHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# helper.concat_strings("this","that").should == "this that"
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
describe Platforms::KeyPairsHelper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
|
@ -1,5 +1,21 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe KeyPair do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
before(:all) do
|
||||
stub_symlink_methods
|
||||
FactoryGirl.create(:key_pair)
|
||||
end
|
||||
|
||||
it { should belong_to(:repository) }
|
||||
it { should belong_to(:user)}
|
||||
|
||||
it { should_not allow_mass_assignment_of(:user) }
|
||||
it { should_not allow_mass_assignment_of(:key_id) }
|
||||
|
||||
after(:all) do
|
||||
Platform.delete_all
|
||||
User.delete_all
|
||||
Product.delete_all
|
||||
FileUtils.rm_rf(APP_CONFIG['root_path'])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue