Sha256: ef2a4e692eb5edd89d2a42c88f2dca53b944f531dca1072f948a2c08a4b89788

Contents?: true

Size: 987 Bytes

Versions: 1

Compression:

Stored size: 987 Bytes

Contents

require 'spec_helper'

describe ManageableContent::PageContent do

  context "fields" do
    it { should have_db_column(:page_id).of_type(:integer) }
    it { should have_db_column(:key).of_type(:string) }
    it { should have_db_column(:content).of_type(:text) }
    it { should have_db_column(:created_at).of_type(:datetime) }
    it { should have_db_column(:updated_at).of_type(:datetime) }

    it { should have_db_index([:page_id, :key]).unique(true) }
  end

  context "mass assignment" do
    it { should allow_mass_assignment_of(:content) }

    it { should_not allow_mass_assignment_of(:key) }
    it { should_not allow_mass_assignment_of(:page_id) }
    it { should_not allow_mass_assignment_of(:updated_at) }
    it { should_not allow_mass_assignment_of(:created_at) }
  end

  context "validations" do
    it { should validate_presence_of(:page_id) }
    it { should validate_presence_of(:key) }
  end

  context "associations" do
    it { should belong_to :page }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
manageable_content-0.0.1 spec/models/manageable_content/page_content_spec.rb