forked from bofh/fetsite
Upgraded to Rails 4
This commit is contained in:
@@ -2,12 +2,12 @@ require 'spec_helper'
|
||||
|
||||
describe Studium do
|
||||
# test if it is invalid if certain attributes are missing
|
||||
let(:studium) { FactoryGirl.build(:studium)}
|
||||
let(:studium) { FactoryBot.build(:studium)}
|
||||
let(:object_variable) {studium}
|
||||
|
||||
[:name, :zahl].each do |attr|
|
||||
it "should not be valid without #{attr}" do
|
||||
s = FactoryGirl.build(:studium, attr=>nil)
|
||||
s = FactoryBot.build(:studium, attr=>nil)
|
||||
expect(s).not_to be_valid
|
||||
end
|
||||
end
|
||||
@@ -15,12 +15,12 @@ describe Studium do
|
||||
it_behaves_like "a valid object"
|
||||
|
||||
it "should create studium with valid data" do
|
||||
s=FactoryGirl.build(:studium)
|
||||
s=FactoryBot.build(:studium)
|
||||
lambda {
|
||||
s.save!; Sunspot.commit}.should change {Studium.count()}.by(1)
|
||||
end
|
||||
it "should not accept double entrys" do
|
||||
FactoryGirl.create(:studium)
|
||||
FactoryBot.create(:studium)
|
||||
expect(studium).not_to be_valid
|
||||
|
||||
|
||||
@@ -28,14 +28,14 @@ describe Studium do
|
||||
expect(studium).to have_at_least(1).error_on(:zahl)
|
||||
end
|
||||
it "expect zahl to be 000.000" do
|
||||
s=FactoryGirl.build(:studium, :zahl=>"000.000")
|
||||
s=FactoryBot.build(:studium, :zahl=>"000.000")
|
||||
#Sunspot.commit
|
||||
s.should_not be_valid
|
||||
expect(s.errors.size).to be > 0
|
||||
end
|
||||
|
||||
it "is not valid with a short zahl" do
|
||||
s=FactoryGirl.build(:studium, :zahl=>"123")
|
||||
s=FactoryBot.build(:studium, :zahl=>"123")
|
||||
expect(s).not_to be_valid
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user