Sha256: 7182b2d581a7ba9c123e6a0f624f20a0a69ec4ed3d77a342f1b7ddbdeb2db0e8
Contents?: true
Size: 1.48 KB
Versions: 13
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' include DynamicFieldsets describe FieldRecord do include FieldRecordHelper it "should respond to field" do FieldRecord.new.should respond_to :field end it "should respond to fieldset_associator" do FieldRecord.new.should respond_to :fieldset_associator end describe "validations" do before(:each) do @field_record = FieldRecord.new end it "should be valid" do @field_record.fieldset_child = FieldsetChild.new @field_record.fieldset_associator = FieldsetAssociator.new @field_record.value = "42" child = mock_model(DynamicFieldsets::Field) @field_record.fieldset_child = FieldsetChild.new(:child => child) @field_record.should be_valid end it "should require field" do @field_record.should have(1).error_on(:fieldset_child) end it "should require fieldset_associator" do @field_record.should have(1).error_on(:fieldset_associator) end it "should require value" do @field_record.should have(1).error_on(:value) end it "should not error if value is a blank string" do @field_record.value = "" @field_record.should have(0).error_on(:value) end it "should error if the fieldset_child has the wrong type" do child = mock_model(DynamicFieldsets::Fieldset) @field_record.fieldset_child = FieldsetChild.new(:child => child) @field_record.valid? @field_record.should have(1).error_on(:fieldset_child) end end end
Version data entries
13 entries across 13 versions & 1 rubygems