Sha256: 4933f6b682c09cd40e4e06078f4565216c86ec1f86e2b1176b317087bc74cf9a

Contents?: true

Size: 798 Bytes

Versions: 2

Compression:

Stored size: 798 Bytes

Contents

require "spec_helper"
require "formalist/elements/standard/check_box"

RSpec.describe Formalist::Elements::CheckBox do
  subject(:check_box) {
    Formalist::Elements::CheckBox.new(:published, attributes, [], {published: input}, errors)
  }

  let(:attributes) { {} }
  let(:input) { nil }
  let(:errors) { {} }

  describe "input" do
    context "is nil" do
      specify { expect(check_box.input).to eql false }
    end

    context "is false" do
      let(:input) { false }
      specify { expect(check_box.input).to eql false }
    end

    context "is true" do
      let(:input) { true }
      specify { expect(check_box.input).to eql true }
    end

    context "is any other value" do
      let(:input) { "something" }
      specify { expect(check_box.input).to eql true }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
formalist-0.3.0 spec/unit/elements/standard/check_box_spec.rb
formalist-0.2.3 spec/unit/elements/standard/check_box_spec.rb