Sha256: b9e35586c33c8d1172f81c10042891c3739f86648f05cb2b85e89654145a0448

Contents?: true

Size: 817 Bytes

Versions: 14

Compression:

Stored size: 817 Bytes

Contents

require 'spec_helper'
require './spec/fixtures/tshirt'

describe Ardm::Property::Boolean do
  before do
    @name          = :active
    @type          = described_class
    @load_as     = TrueClass
    @value         = true
    @other_value   = false
    @invalid_value = 1
  end

  it_should_behave_like 'A public Property'

  describe '.options' do
    subject { described_class.options }

    it { is_expected.to be_kind_of(Hash) }

    it { is_expected.to eql(:load_as => @load_as, :dump_as => @load_as, :coercion_method => :to_boolean) }
  end

  describe "default" do
    it "should set has_picture to the default (booleans are specifically weird in rails because presence validation fails for false)" do
      tshirt = Ardm::Fixtures::TShirt.create!
      expect(tshirt).not_to have_picture
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ardm-0.4.0.ar427 spec/public/property/boolean_spec.rb
ardm-0.4.0 spec/public/property/boolean_spec.rb
ardm-0.3.2 spec/public/property/boolean_spec.rb
ardm-0.3.1 spec/public/property/boolean_spec.rb
ardm-0.3.0 spec/public/property/boolean_spec.rb
ardm-0.2.7 spec/public/property/boolean_spec.rb
ardm-0.2.6 spec/public/property/boolean_spec.rb
ardm-0.2.5 spec/public/property/boolean_spec.rb
ardm-0.2.4 spec/public/property/boolean_spec.rb
ardm-0.2.3 spec/public/property/boolean_spec.rb
ardm-0.2.2 spec/public/property/boolean_spec.rb
ardm-0.2.1 spec/public/property/boolean_spec.rb
ardm-0.2.0 spec/public/property/boolean_spec.rb
ardm-0.1.0 spec/public/property/boolean_spec.rb