mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-26 04:21:36 +00:00
Add initial forum tests
This commit is contained in:
parent
01d0a5d80a
commit
d4acc8ea3c
2 changed files with 35 additions and 0 deletions
6
spec/factories/forum.rb
Normal file
6
spec/factories/forum.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
FactoryGirl.define do
|
||||
factory :forum do
|
||||
sequence(:title) { |n| "Forum Title #{n}" }
|
||||
sequence(:description) { |n| "Forum Description #{n}" }
|
||||
end
|
||||
end
|
29
spec/models/forum_spec.rb
Normal file
29
spec/models/forum_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: forums
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# title :string(255)
|
||||
# description :string(255)
|
||||
# category_id :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# position :integer
|
||||
#
|
||||
|
||||
require "spec_helper"
|
||||
|
||||
describe Forum do
|
||||
let!(:user) { create :user }
|
||||
|
||||
describe "create" do
|
||||
let(:forum) { build :forum }
|
||||
|
||||
it "creates a new forum" do
|
||||
expect(forum.valid?).to eq(true)
|
||||
expect do
|
||||
forum.save!
|
||||
end.to change(Forum, :count).by(1)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue