adds spec for Setting
This commit is contained in:
committed by
Juanjo Bazán
parent
de71f55103
commit
916f0bf901
29
db/schema.rb
29
db/schema.rb
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20150828085718) do
|
ActiveRecord::Schema.define(version: 20150830212600) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -67,8 +67,8 @@ ActiveRecord::Schema.define(version: 20150828085718) do
|
|||||||
t.integer "rgt"
|
t.integer "rgt"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.datetime "hidden_at"
|
|
||||||
t.integer "children_count", default: 0
|
t.integer "children_count", default: 0
|
||||||
|
t.datetime "hidden_at"
|
||||||
t.integer "flags_count", default: 0
|
t.integer "flags_count", default: 0
|
||||||
t.datetime "ignored_flag_at"
|
t.datetime "ignored_flag_at"
|
||||||
t.integer "moderator_id"
|
t.integer "moderator_id"
|
||||||
@@ -87,20 +87,21 @@ ActiveRecord::Schema.define(version: 20150828085718) do
|
|||||||
add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
|
add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
|
||||||
|
|
||||||
create_table "debates", force: :cascade do |t|
|
create_table "debates", force: :cascade do |t|
|
||||||
t.string "title", limit: 80
|
t.string "title", limit: 80
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.string "visit_id"
|
|
||||||
t.datetime "hidden_at"
|
t.datetime "hidden_at"
|
||||||
t.integer "flags_count", default: 0
|
t.string "visit_id"
|
||||||
t.integer "cached_votes_total", default: 0
|
t.integer "flags_count", default: 0
|
||||||
t.integer "cached_votes_up", default: 0
|
|
||||||
t.integer "cached_votes_down", default: 0
|
|
||||||
t.datetime "ignored_flag_at"
|
t.datetime "ignored_flag_at"
|
||||||
t.integer "comments_count", default: 0
|
t.integer "cached_votes_total", default: 0
|
||||||
|
t.integer "cached_votes_up", default: 0
|
||||||
|
t.integer "cached_votes_down", default: 0
|
||||||
|
t.integer "comments_count", default: 0
|
||||||
t.datetime "confirmed_hide_at"
|
t.datetime "confirmed_hide_at"
|
||||||
|
t.integer "cached_anonymous_votes_total", default: 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "debates", ["cached_votes_down"], name: "index_debates_on_cached_votes_down", using: :btree
|
add_index "debates", ["cached_votes_down"], name: "index_debates_on_cached_votes_down", using: :btree
|
||||||
@@ -199,12 +200,13 @@ ActiveRecord::Schema.define(version: 20150828085718) do
|
|||||||
t.string "unconfirmed_email"
|
t.string "unconfirmed_email"
|
||||||
t.boolean "email_on_debate_comment", default: false
|
t.boolean "email_on_debate_comment", default: false
|
||||||
t.boolean "email_on_comment_reply", default: false
|
t.boolean "email_on_comment_reply", default: false
|
||||||
t.string "phone_number", limit: 30
|
|
||||||
t.string "official_position"
|
t.string "official_position"
|
||||||
t.integer "official_level", default: 0
|
t.integer "official_level", default: 0
|
||||||
t.datetime "hidden_at"
|
t.datetime "hidden_at"
|
||||||
t.string "sms_confirmation_code"
|
t.string "phone_number", limit: 30
|
||||||
t.string "username"
|
t.string "username"
|
||||||
|
t.datetime "confirmed_hide_at"
|
||||||
|
t.string "sms_confirmation_code"
|
||||||
t.string "document_number"
|
t.string "document_number"
|
||||||
t.string "document_type"
|
t.string "document_type"
|
||||||
t.datetime "residence_verified_at"
|
t.datetime "residence_verified_at"
|
||||||
@@ -216,7 +218,6 @@ ActiveRecord::Schema.define(version: 20150828085718) do
|
|||||||
t.string "unconfirmed_phone"
|
t.string "unconfirmed_phone"
|
||||||
t.string "confirmed_phone"
|
t.string "confirmed_phone"
|
||||||
t.datetime "letter_requested_at"
|
t.datetime "letter_requested_at"
|
||||||
t.datetime "confirmed_hide_at"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
|
add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
|
||||||
|
|||||||
15
spec/models/setting_spec.rb
Normal file
15
spec/models/setting_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe Setting do
|
||||||
|
|
||||||
|
it "should be accesible by key" do
|
||||||
|
create(:setting, key: "Important Setting", value: "42")
|
||||||
|
|
||||||
|
expect(Setting.value_for("Important Setting")).to eq("42")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should be nil if key does not exist" do
|
||||||
|
expect(Setting.value_for("Undefined key")).to be_nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user