From f91049845ae84e1f4867105a886d56d2f0be49d6 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Tue, 19 Apr 2016 11:03:38 +0200 Subject: [PATCH] add lxd_host model --- app/models/lxd_host.rb | 3 +++ db/migrate/20160419090228_create_lxd_hosts.rb | 11 +++++++++++ test/fixtures/lxd_hosts.yml | 11 +++++++++++ test/models/lxd_host_test.rb | 7 +++++++ 4 files changed, 32 insertions(+) create mode 100644 app/models/lxd_host.rb create mode 100644 db/migrate/20160419090228_create_lxd_hosts.rb create mode 100644 test/fixtures/lxd_hosts.yml create mode 100644 test/models/lxd_host_test.rb diff --git a/app/models/lxd_host.rb b/app/models/lxd_host.rb new file mode 100644 index 0000000..da7d170 --- /dev/null +++ b/app/models/lxd_host.rb @@ -0,0 +1,3 @@ +class LxdHost < ActiveRecord::Base + has_secure_password +end diff --git a/db/migrate/20160419090228_create_lxd_hosts.rb b/db/migrate/20160419090228_create_lxd_hosts.rb new file mode 100644 index 0000000..e2919e7 --- /dev/null +++ b/db/migrate/20160419090228_create_lxd_hosts.rb @@ -0,0 +1,11 @@ +class CreateLxdHosts < ActiveRecord::Migration + def change + create_table :lxd_hosts do |t| + t.text :name + t.text :uri + t.string :password_digest + + t.timestamps null: false + end + end +end diff --git a/test/fixtures/lxd_hosts.yml b/test/fixtures/lxd_hosts.yml new file mode 100644 index 0000000..082e981 --- /dev/null +++ b/test/fixtures/lxd_hosts.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + name: MyText + uri: MyText + password_digest: <%= BCrypt::Password.create('secret') %> + +two: + name: MyText + uri: MyText + password_digest: <%= BCrypt::Password.create('secret') %> diff --git a/test/models/lxd_host_test.rb b/test/models/lxd_host_test.rb new file mode 100644 index 0000000..fd6fc25 --- /dev/null +++ b/test/models/lxd_host_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class LxdHostTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end