AutoCommit Don Sep 10 21:03:02 CEST 2015
This commit is contained in:
@@ -1,19 +1,24 @@
|
||||
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
|
||||
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 "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)
|
||||
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
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
6
spec/models/rubrik_spec.rb
Normal file
6
spec/models/rubrik_spec.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Rubrik do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
|
||||
end
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user