forked from bofh/fetsite
Upgraded to Rails 4
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Gremium do
|
||||
let(:gremium) {FactoryGirl.build(:gremium)}
|
||||
let(:gremium) {FactoryBot.build(:gremium)}
|
||||
let(:object_variable){gremium}
|
||||
it_behaves_like "a valid object"
|
||||
|
||||
[:name,:typ].each do |attr|
|
||||
it "is not valid without #{attr}" do
|
||||
g = FactoryGirl.build(:gremium,attr.to_sym => nil)
|
||||
g = FactoryBot.build(:gremium,attr.to_sym => nil)
|
||||
expect(g).not_to be_valid
|
||||
expect(g.errors[attr]).to have_at_least(1).items
|
||||
end
|
||||
@@ -18,33 +18,33 @@ describe Gremium do
|
||||
|
||||
it "is not valid with wrong typ" do
|
||||
((-5..30).to_a-Gremium::TYPEN.keys()).each do |i|
|
||||
g = FactoryGirl.build(:gremium, typ: i)
|
||||
g = FactoryBot.build(:gremium, typ: i)
|
||||
expect(g).not_to be_valid
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it "is in tabs if typ is 1" do
|
||||
g = FactoryGirl.create(:gremium, typ: 1)
|
||||
g = FactoryBot.create(:gremium, typ: 1)
|
||||
expect(Gremium.tabs).to eq([g])
|
||||
end
|
||||
|
||||
|
||||
it "is not in tabs if typ is not 1 or 3" do
|
||||
g = FactoryGirl.create(:gremium, typ: 2)
|
||||
g = FactoryBot.create(:gremium, typ: 2)
|
||||
expect(Gremium.tabs).to eq([])
|
||||
end
|
||||
it "destroys memberships if its destroyed" do
|
||||
g=FactoryGirl.create(:gremium)
|
||||
fp=FactoryGirl.create(:fetprofile)
|
||||
m=FactoryGirl.create(:membership, gremium_id: g.id, fetprofile_id: fp.id)
|
||||
g=FactoryBot.create(:gremium)
|
||||
fp=FactoryBot.create(:fetprofile)
|
||||
m=FactoryBot.create(:membership, gremium_id: g.id, fetprofile_id: fp.id)
|
||||
expect{g.destroy}.to change {Membership.count}.by(-1)
|
||||
|
||||
|
||||
end
|
||||
|
||||
it "responds to title" do
|
||||
g=FactoryGirl.build(:gremium)
|
||||
g=FactoryBot.build(:gremium)
|
||||
expect(g.respond_to?(:title)).to be true
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user