Sha256: fb101c89294ccda827366c1468affaca081804bf4272ebfc3b655b11b9064308

Contents?: true

Size: 1.49 KB

Versions: 15

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'
require 'integration/conditional_validation/spec_helper'

describe 'DataMapper::Validations::Fixtures::UDPPacket' do
  before :all do
    DataMapper::Validations::Fixtures::UDPPacket.auto_migrate!

    @model = DataMapper::Validations::Fixtures::UDPPacket.new
  end

  describe "that is transported encapsulated into IPv4 packet" do
    before :all do
      @model.underlying_ip_version = 4
    end

    describe "and has no checksum" do
      before :all do
        @model.checksum = nil
      end

      it_should_behave_like "valid model"
    end

    describe "and has no checksum algorithm" do
      before :all do
        @model.checksum_algorithm = nil
      end

      it_should_behave_like "valid model"
    end
  end


  describe "that is transported encapsulated into IPv6 packet" do
    before :all do
      @model.underlying_ip_version = 6
    end

    describe "and has no checksum" do
      before :all do
        @model.checksum = nil
      end

      it_should_behave_like "invalid model"

      it "has a meaningful error message" do
        @model.errors.on(:checksum).should == [ 'Checksum is mandatory when used with IPv6' ]
      end
    end

    describe "and has no checksum algorithm" do
      before :all do
        @model.checksum_algorithm = nil
      end

      it_should_behave_like "invalid model"

      it "has a meaningful error message" do
        @model.errors.on(:checksum_algorithm).should == [ 'Checksum is mandatory when used with IPv6' ]
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
ardm-validations-1.2.0 spec/integration/conditional_validation/if_condition_spec.rb
aequitas-0.0.1 spec_legacy/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.2.0 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.2.0.rc2 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.2.0.rc1 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.1.0 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.1.0.rc3 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.1.0.rc2 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.1.0.rc1 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.0.2 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.0.1 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.0.0 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.0.0.rc3 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.0.0.rc2 spec/integration/conditional_validation/if_condition_spec.rb
dm-validations-1.0.0.rc1 spec/integration/conditional_validation/if_condition_spec.rb