Commit f1ecf53c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Broadcast message model + migrations

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 0a08c775
class BroadcastMessage < ActiveRecord::Base
attr_accessible :alert_type, :ends_at, :message, :starts_at
validates :message, presence: true
end
class CreateBroadcastMessages < ActiveRecord::Migration
def change
create_table :broadcast_messages do |t|
t.text :message, null: false
t.datetime :starts_at
t.datetime :ends_at
t.integer :alert_type
t.timestamps
end
end
end
......@@ -11,7 +11,16 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20131106151520) do
ActiveRecord::Schema.define(:version => 20131112114325) do
create_table "broadcast_messages", :force => true do |t|
t.text "message", :null => false
t.datetime "starts_at"
t.datetime "ends_at"
t.integer "alert_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "deploy_keys_projects", :force => true do |t|
t.integer "deploy_key_id", :null => false
......
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :broadcast_message do
message "MyText"
starts_at "2013-11-12 13:43:25"
ends_at "2013-11-12 13:43:25"
alert_type 1
end
end
require 'spec_helper'
describe BroadcastMessage do
subject { create(:broadcast_message) }
it { should be_valid }
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment