Modul sollte keine Abhängigkeit von Modulgruppe haben
This commit is contained in:
@@ -18,7 +18,7 @@ class Modul < ActiveRecord::Base
|
||||
has_and_belongs_to_many :modulgruppen
|
||||
|
||||
|
||||
validates :modulgruppen, :presence=>true # Ein Modul muss zu einer Modulgruppe gehören
|
||||
# validates :modulgruppen, :presence=>true # Ein Modul muss zu einer Modulgruppe gehören
|
||||
validates :name, :presence=>true # Ein Modul muss einen Namen haben
|
||||
translates :desc,:depend,:name, :versioning =>true, :fallbacks_for_empty_translations => true
|
||||
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :modul do
|
||||
name ""
|
||||
factory :other_modul do
|
||||
name "Modul 1"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Modul do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
it "should not be valid without name" do
|
||||
m = FactoryGirl.build(:modul)
|
||||
m.should_not be_valid
|
||||
m.should have(1).errors_on(:name)
|
||||
end
|
||||
it "should be valid with name" do
|
||||
m = FactoryGirl.build(:modul)
|
||||
m.name = "Grundlagen"
|
||||
m.should be_valid
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user