File: value_coerced_predicate_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 (25 lines) | stat: -rw-r--r-- 494 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
require 'spec_helper'

describe Virtus::Attribute::Boolean, '#value_coerced?' do
  subject { object.value_coerced?(input) }

  let(:object) { described_class.build('Boolean') }

  context 'when input is true' do
    let(:input) { true }

    it { is_expected.to be(true) }
  end

  context 'when input is false' do
    let(:input) { false }

    it { is_expected.to be(true) }
  end

  context 'when input is not coerced' do
    let(:input) { 1 }

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