File: coerce_spec.rb

package info (click to toggle)
ruby-virtus 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 660 kB
  • sloc: ruby: 4,378; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 628 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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