From edaf15454902d62643c8f09fccd8b46f40008b99 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Thu, 10 Sep 2015 21:03:02 +0200 Subject: [PATCH] AutoCommit Don Sep 10 21:03:02 CEST 2015 --- spec/models/calentry_spec.rb | 33 +++++++++++++++++++-------------- spec/models/news.rb | 7 ++++++- spec/models/rubrik_spec.rb | 6 ++++++ spec/spec_helper.rb | 2 +- 4 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 spec/models/rubrik_spec.rb diff --git a/spec/models/calentry_spec.rb b/spec/models/calentry_spec.rb index 8c29c7e..a8ec91b 100644 --- a/spec/models/calentry_spec.rb +++ b/spec/models/calentry_spec.rb @@ -1,20 +1,25 @@ require 'spec_helper' describe Calentry do - it "should be valid with full data" do - e = FactoryGirl.build(:calentry) - c = FactoryGirl.create(:calendar) - e.calendars << c - e.should be_valid - end - [:ende,:start,:typ].each do |attr| - it "should not be valid without #{attr}" do - e= FactoryGirl.build(:calentry, attr => nil) - c=FactoryGirl.create(:calendar) - e.calendars << c - e.should_not be_valid - e.should have_at_least(1).errors_on(attr) - end + before(:each) do + @user = FactoryGirl.create(:user) + end + let(:rubrik) {FactoryGirl.create(:rubrik)} + let(:user) {FactoryGirl.create(:user)} + let(:calendar) {FactoryGirl.create(:calendar)} + let(:neuigkeit) {FactoryGirl.create(:neuigkeit, rubrik_id: rubrik.id, author_id: user.id)} + + it "should be valid with full data" do + e = FactoryGirl.build(:calentry, calendar_id: calendar.id, object_type: "Neuigkeit",object_id: neuigkeit.id) + expect(e).to be_valid + end + + [:ende,:start,:typ].each do |attr| + it "is not valid without #{attr}" do + e= FactoryGirl.build(:calentry, calendar_id: calendar.id, object_type: "Neuigkeit",object_id: neuigkeit.id, attr => nil) + expect(e).not_to be_valid + expect(e).to have_at_least(1).errors_on(attr) + end end end diff --git a/spec/models/news.rb b/spec/models/news.rb index a4c7afd..0a49b2b 100644 --- a/spec/models/news.rb +++ b/spec/models/news.rb @@ -1 +1,6 @@ -require 'neuigkeit_spec.rb' +require 'models/neuigkeit_spec.rb' +require 'models/rubrik_spec.rb' +require 'models/attachment_spec.rb' +require 'models/calentry_spec.rb' +require 'models/calendar_spec.rb' +require 'models/nlink_spec.rb' diff --git a/spec/models/rubrik_spec.rb b/spec/models/rubrik_spec.rb new file mode 100644 index 0000000..4251f9c --- /dev/null +++ b/spec/models/rubrik_spec.rb @@ -0,0 +1,6 @@ +require 'spec_helper' + +describe Rubrik do + pending "add some examples to (or delete) #{__FILE__}" + +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 35e791c..90d68f8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -33,7 +33,7 @@ RSpec.configure do |config| # config.mock_with :rr # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" +# config.fixture_path = "#{::Rails.root}/spec/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false