Remove unused Pool methods: create_anonymous/options/id_to_name (#3206)

* Pool.id_to_name: never used.
* Pool.create_anonymous: never used.
* Pool.options: unused since e7aff87.
This commit is contained in:
evazion
2017-07-09 14:32:17 -05:00
parent af35c82d96
commit 76c90cc0e4
2 changed files with 0 additions and 33 deletions

View File

@@ -118,23 +118,6 @@ class Pool < ApplicationRecord
end
end
def self.id_to_name(id)
select_value_sql("SELECT name FROM pools WHERE id = ?", id)
end
def self.options
select_all_sql("SELECT id, name FROM pools WHERE is_active = true AND is_deleted = false ORDER BY name LIMIT 100").map {|x| [x["name"].tr("_", " "), x["id"]]}
end
def self.create_anonymous
Pool.new do |pool|
pool.name = "TEMP:#{Time.now.to_f}.#{rand(1_000_000)}"
pool.save
pool.name = "anon:#{pool.id}"
pool.save
end
end
def self.normalize_name(name)
name.gsub(/\s+/, "_")
end

View File

@@ -53,10 +53,6 @@ class PoolTest < ActiveSupport::TestCase
should "be mapped to a pool id" do
assert_equal(@pool.id, Pool.name_to_id(@pool.id.to_s))
end
should "be mapped to its name" do
assert_equal(@pool.name, Pool.id_to_name(@pool.id))
end
end
context "Reverting a pool" do
@@ -317,16 +313,4 @@ class PoolTest < ActiveSupport::TestCase
assert_nil(@p3_neighbors.next)
end
end
context "An anonymous pool" do
setup do
user = Timecop.travel(1.month.ago) {FactoryGirl.create(:user)}
CurrentUser.user = user
end
should "have a name starting with anon" do
pool = Pool.create_anonymous
assert_match(/^anon:\d+$/, pool.name)
end
end
end