[refs #441] Remove unused files. Add mass assigment specs

This commit is contained in:
konstantin.grabar 2012-07-17 13:31:32 +04:00
parent a5af7d72d9
commit 3a183e0dc3
7 changed files with 20 additions and 29 deletions

View File

@ -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/

View File

@ -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/

View File

@ -1,2 +0,0 @@
module Platforms::KeyPairsHelper
end

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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