2012-10-09 11:14:17 +03:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: wikis
|
|
|
|
#
|
2012-11-19 21:24:05 +03:00
|
|
|
# id :integer not null, primary key
|
2012-10-09 11:14:17 +03:00
|
|
|
# title :string(255)
|
|
|
|
# content :text
|
|
|
|
# project_id :integer
|
2012-11-19 21:24:05 +03:00
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
2012-10-09 11:14:17 +03:00
|
|
|
# slug :string(255)
|
|
|
|
# user_id :integer
|
|
|
|
#
|
|
|
|
|
2012-03-28 22:53:45 +03:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Wiki do
|
|
|
|
describe "Associations" do
|
|
|
|
it { should belong_to(:project) }
|
|
|
|
it { should belong_to(:user) }
|
2012-08-29 11:36:02 -04:00
|
|
|
it { should have_many(:notes).dependent(:destroy) }
|
2012-03-28 22:53:45 +03:00
|
|
|
end
|
|
|
|
|
2012-09-26 11:17:17 -07:00
|
|
|
describe "Mass assignment" do
|
|
|
|
it { should_not allow_mass_assignment_of(:project_id) }
|
|
|
|
it { should_not allow_mass_assignment_of(:user_id) }
|
|
|
|
end
|
|
|
|
|
2012-03-28 22:53:45 +03:00
|
|
|
describe "Validation" do
|
|
|
|
it { should validate_presence_of(:title) }
|
2012-08-29 11:36:02 -04:00
|
|
|
it { should ensure_length_of(:title).is_within(1..250) }
|
2012-03-28 22:53:45 +03:00
|
|
|
it { should validate_presence_of(:content) }
|
2012-10-09 04:10:16 +04:00
|
|
|
it { should validate_presence_of(:user) }
|
2012-03-28 22:53:45 +03:00
|
|
|
end
|
|
|
|
end
|