AutoCommit Sam Sep 12 12:03:06 CEST 2015
This commit is contained in:
@@ -3,22 +3,22 @@ require 'spec_helper'
|
||||
describe Neuigkeit do
|
||||
let(:rubrik) {FactoryGirl.create(:rubrik)}
|
||||
let(:user) {FactoryGirl.create(:user)}
|
||||
[:title,:text, :rubrik_id].each do |attr|
|
||||
let(:neuigkeit) {(FactoryGirl.build(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id))}
|
||||
[:title,:text, :rubrik, :author].each do |attr|
|
||||
it "should not be valid without #{attr}" do
|
||||
fp = FactoryGirl.build(:fetprofile)
|
||||
fp.send("#{attr}=".to_sym,nil)
|
||||
fp.should_not be_valid
|
||||
neuigkeit.send("#{attr}=".to_sym,nil)
|
||||
expect(neuigkeit).not_to be_valid
|
||||
expect(neuigkeit.errors[attr]).to have_at_least(1).items
|
||||
end
|
||||
end
|
||||
it "should be created" do
|
||||
|
||||
fp=Fetprofile.new(FactoryGirl.attributes_for(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id))
|
||||
expect(fp.save).to be true
|
||||
expect(neuigkeit).to be_valid
|
||||
expect(neuigkeit.save).to be true
|
||||
end
|
||||
|
||||
it "should be valid" do
|
||||
fp = FactoryGirl.build(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id)
|
||||
fp.should be_valid
|
||||
expect(fp).to be_valid
|
||||
end
|
||||
pending "is parent for attachments "
|
||||
pending "has questions"
|
||||
|
||||
Reference in New Issue
Block a user