From 2c0f3ff0b85373c114b3530eff2ba87d3539fdac Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sun, 30 Mar 2014 20:09:02 +0200 Subject: [PATCH] THEMA TESTS --- spec/factories/themengruppen.rb | 2 +- spec/models/thema_spec.rb | 18 +++++++++++++++++- spec/models/themengruppe_spec.rb | 8 +++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/spec/factories/themengruppen.rb b/spec/factories/themengruppen.rb index 868dca7..5a4f413 100644 --- a/spec/factories/themengruppen.rb +++ b/spec/factories/themengruppen.rb @@ -1,7 +1,7 @@ # Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do - factory :themagruppen, :class => 'Themengruppe' do + factory :themengruppe, :class => 'Themengruppe' do title "MyString" text "MyText" end diff --git a/spec/models/thema_spec.rb b/spec/models/thema_spec.rb index b006262..6bcdc81 100644 --- a/spec/models/thema_spec.rb +++ b/spec/models/thema_spec.rb @@ -1,5 +1,21 @@ require 'spec_helper' describe Thema do - pending "add some examples to (or delete) #{__FILE__}" + + [:text, :title].each do |attr| + it "should not be valid without #{attr}" do + tg=FactoryGirl.build(:themengruppe) + t = FactoryGirl.build(:thema, attr=>nil) + t.themengruppe=tg + t.should_not be_valid + end + end + it "should not be valid without Themengruppe" do + tg=FactoryGirl.build(:themengruppe) + t = FactoryGirl.build(:thema) + t.should_not be_valid + end + + + end diff --git a/spec/models/themengruppe_spec.rb b/spec/models/themengruppe_spec.rb index cf5341f..d504f19 100644 --- a/spec/models/themengruppe_spec.rb +++ b/spec/models/themengruppe_spec.rb @@ -1,5 +1,11 @@ require 'spec_helper' describe Themengruppe do - pending "add some examples to (or delete) #{__FILE__}" + [:text, :title].each do |attr| + it "should not be valid without #{attr}" do + tg=FactoryGirl.build(:themengruppe, attr=>nil) + tg.should_not be_valid + end + end + end