Sha256: adecc22fcb876a9d6852ac16b9c81cfbd4a34c14a7b6fa96f8258466d108acb2

Contents?: true

Size: 755 Bytes

Versions: 11

Compression:

Stored size: 755 Bytes

Contents

require "spec_helper"

RSpec.describe SmsAero::Types::Birthday do
  subject { described_class[source] }

  context "date:" do
    let(:source) { Date.parse "1901-08-17" }
    it { is_expected.to eq "1901-08-17" }
  end

  context "datetime:" do
    let(:source) { DateTime.parse "1901-08-17 10:00:00" }
    it { is_expected.to eq "1901-08-17" }
  end

  context "time:" do
    let(:source) { Time.parse "1901-08-17 10:00:00" }
    it { is_expected.to eq "1901-08-17" }
  end

  context "parceable string:" do
    let(:source) { "1901/08/17" }
    it { is_expected.to eq "1901-08-17" }
  end

  context "imparceable string:" do
    let(:source) { "Foobar" }

    it "fails" do
      expect { subject }.to raise_error(TypeError, /Foobar/)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sms_aero-0.0.11 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.10 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.9 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.8 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.7 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.6 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.5 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.4 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.3 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.2 spec/sms_aero/types/birthday_spec.rb
sms_aero-0.0.1 spec/sms_aero/types/birthday_spec.rb