forked from bofh/fetsite
nes neuigkeiten model specs
This commit is contained in:
@@ -3,9 +3,17 @@ require 'spec_helper'
|
||||
describe Neuigkeit do
|
||||
let(:rubrik) {FactoryGirl.create(:rubrik)}
|
||||
let(:user) {FactoryGirl.create(:user)}
|
||||
let(:calendar) {FactoryGirl.create(:calendar,updated_at: 1.hour.ago)}
|
||||
let(:neuigkeit) {(FactoryGirl.build(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id))}
|
||||
let(:attachment) {FactoryGirl.build_stubbed(:attachment)}
|
||||
|
||||
let(:calentry) do
|
||||
c = FactoryGirl.build(:calentry, calendar_id: calendar.id, start: 1.hour.ago, ende: 5.minutes.ago)
|
||||
c.object=neuigkeit
|
||||
c.save
|
||||
c
|
||||
end
|
||||
|
||||
[ :rubrik, :author].each do |attr| # :title,:text to be discussed
|
||||
it "should not be valid without #{attr}" do
|
||||
neuigkeit.send("#{attr}=".to_sym,nil)
|
||||
@@ -31,10 +39,18 @@ describe Neuigkeit do
|
||||
expect { neuigkeit.attachments << attachment }.to change {neuigkeit.picture_robust}
|
||||
end
|
||||
it "is an event if it has a calentry" do
|
||||
expect(neuigkeit.event?).to be false
|
||||
expect{neuigkeit.calentries << calentry}.to change(neuigkeit, :event?)
|
||||
expect(neuigkeit).not_to be_is_event
|
||||
neuigkeit.calentries << calentry
|
||||
expect(neuigkeit).to be_is_event
|
||||
|
||||
end
|
||||
|
||||
it "it is published if datum is in the past" do
|
||||
neuigkeit.datum=5.hours.ago
|
||||
expect(neuigkeit).to be_published
|
||||
end
|
||||
it "" do
|
||||
end
|
||||
|
||||
pending "has questions"
|
||||
pending "has nlinks"
|
||||
pending "has calentries"
|
||||
|
||||
Reference in New Issue
Block a user