AutoCommit Don Sep 10 21:03:02 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-09-10 21:03:02 +02:00
parent f59f0cb05a
commit edaf154549
4 changed files with 32 additions and 16 deletions

View File

@@ -1,19 +1,24 @@
require 'spec_helper' require 'spec_helper'
describe Calentry do describe Calentry do
it "should be valid with full data" do before(:each) do
e = FactoryGirl.build(:calentry) @user = FactoryGirl.create(:user)
c = FactoryGirl.create(:calendar)
e.calendars << c
e.should be_valid
end 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| [:ende,:start,:typ].each do |attr|
it "should not be valid without #{attr}" do it "is not valid without #{attr}" do
e= FactoryGirl.build(:calentry, attr => nil) e= FactoryGirl.build(:calentry, calendar_id: calendar.id, object_type: "Neuigkeit",object_id: neuigkeit.id, attr => nil)
c=FactoryGirl.create(:calendar) expect(e).not_to be_valid
e.calendars << c expect(e).to have_at_least(1).errors_on(attr)
e.should_not be_valid
e.should have_at_least(1).errors_on(attr)
end end
end end

View File

@@ -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'

View File

@@ -0,0 +1,6 @@
require 'spec_helper'
describe Rubrik do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -33,7 +33,7 @@ RSpec.configure do |config|
# config.mock_with :rr # config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures # 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 # 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 # examples within a transaction, remove the following line or assign false