Sha256: 73566249404bba9d6e089c71bce2c6be8de5300b39e2f6c7b6e72f15fd778fe9
Contents?: true
Size: 858 Bytes
Versions: 4
Compression:
Stored size: 858 Bytes
Contents
# frozen_string_literal: true describe Sail::Types::Boolean, type: :lib do let(:setting) { Sail::Setting.create!(name: :setting, cast_type: :boolean, value: "true") } describe "#to_value" do subject { described_class.new(setting).to_value } it { is_expected.to eq(true) } end describe "#from" do subject { described_class.new(setting).from(value) } context "when value is a Boolean as a string" do let(:value) { "true" } it { is_expected.to eq("true") } end context "when value is the string on" do let(:value) { "on" } it { is_expected.to eq("true") } end context "when value is a Boolean" do let(:value) { true } it { is_expected.to eq("true") } end context "when value is nil" do let(:value) { nil } it { is_expected.to eq("false") } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sail-3.2.0 | spec/lib/types/boolean_spec.rb |
sail-3.1.0 | spec/lib/types/boolean_spec.rb |
sail-3.0.1 | spec/lib/types/boolean_spec.rb |
sail-3.0.0 | spec/lib/types/boolean_spec.rb |