gremium und studien factory und specs
This commit is contained in:
@@ -1,27 +1,35 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Gremium do
|
||||
it "can be created" do
|
||||
g=FactoryGirl.build(:gremium)
|
||||
expect(g.save).to be true
|
||||
end
|
||||
it "is valid with all attributes" do
|
||||
g = FactoryGirl.build(:gremium)
|
||||
g.should be_valid
|
||||
end
|
||||
let(:gremium) {FactoryGirl.build(:gremium)}
|
||||
let(:object_variable){gremium}
|
||||
it_behaves_like "a valid object"
|
||||
|
||||
[:name,:typ].each do |attr|
|
||||
it "should not be valid without #{attr}" do
|
||||
g = FactoryGirl.build(:gremium)
|
||||
g.send("#{attr}=".to_sym,nil)
|
||||
it "is not valid without #{attr}" do
|
||||
g = FactoryGirl.build(:gremium,attr.to_sym => nil)
|
||||
expect(g).not_to be_valid
|
||||
expect(g.errors[attr]).to have_at_least(1).items
|
||||
|
||||
end
|
||||
end
|
||||
it "is in tabs if typ is 1 or 3" do
|
||||
|
||||
pending "only accepts valid types"
|
||||
pending "only accepts valid geschlecht"
|
||||
|
||||
it "is not valid with wrong typ" do
|
||||
((-5..30).to_a-Gremium::TYPEN.keys()).each do |i|
|
||||
g = FactoryGirl.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)
|
||||
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)
|
||||
expect(Gremium.tabs).to eq([])
|
||||
|
||||
Reference in New Issue
Block a user