Sha256: 19988a48e48fa87bbc2b2653feae3d5e488105aa9211db6c17148ed35582c0b6

Contents?: true

Size: 628 Bytes

Versions: 15

Compression:

Stored size: 628 Bytes

Contents

require 'spec_helper'

describe Virtus::Attribute, '.coerce' do
  subject { described_class.coerce }

  after :all do
    described_class.coerce(true)
  end

  context 'with a value' do
    it 'sets the value and return self' do
      expect(described_class.coerce(false)).to be(described_class)
      expect(subject).to be(false)
    end
  end

  context 'when it is set to true' do
    before do
      described_class.coerce(true)
    end

    it { is_expected.to be(true) }
  end

  context 'when it is set to false' do
    before do
      described_class.coerce(false)
    end

    it { is_expected.to be(false) }
  end
end

Version data entries

15 entries across 13 versions & 5 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/virtus-2.0.0/spec/unit/virtus/attribute/class_methods/coerce_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/virtus-2.0.0/spec/unit/virtus/attribute/class_methods/coerce_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/virtus-2.0.0/spec/unit/virtus/attribute/class_methods/coerce_spec.rb
virtus2-2.1.0 spec/unit/virtus/attribute/class_methods/coerce_spec.rb
virtus2-2.0.2 spec/unit/virtus/attribute/class_methods/coerce_spec.rb
virtus2-2.0.1 spec/unit/virtus/attribute/class_methods/coerce_spec.rb
virtus-2.0.0 spec/unit/virtus/attribute/class_methods/coerce_spec.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/virtus-1.0.5/spec/unit/virtus/attribute/class_methods/coerce_spec.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/virtus-1.0.5/spec/unit/virtus/attribute/class_methods/coerce_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/virtus-1.0.5/spec/unit/virtus/attribute/class_methods/coerce_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/virtus-1.0.5/spec/unit/virtus/attribute/class_methods/coerce_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/virtus-1.0.5/spec/unit/virtus/attribute/class_methods/coerce_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/virtus-1.0.5/spec/unit/virtus/attribute/class_methods/coerce_spec.rb
virtus-1.0.5 spec/unit/virtus/attribute/class_methods/coerce_spec.rb
virtus-1.0.4 spec/unit/virtus/attribute/class_methods/coerce_spec.rb