Sha256: 9cfbf9e992faa44883403a90b4c45764db57ee0513eab55194510874e5e95f97

Contents?: true

Size: 692 Bytes

Versions: 5

Compression:

Stored size: 692 Bytes

Contents

require 'spec_helper'

RSpec.describe ComposedValidations::OrStringJoiner do
  subject { described_class.new(*strings) }
  context "when there's two strings" do
    let(:strings) { ["one", "two"] }
    it "should join with or" do
      expect(subject.to_s).to eq "one or two"
    end
  end
  context "when there's three strings" do
    let(:strings) { ["one", "two", "three"] }
    it "should join with a comma and or" do
      expect(subject.to_s).to eq "one, two or three"
    end
  end
  context "when there's four strings" do
    let(:strings) { ["one", "two", "three", "four"] }
    it "should join nicely" do
      expect(subject.to_s).to eq "one, two, three or four"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
composed_validations-0.0.5 spec/composed_validations/or_string_joiner_spec.rb
composed_validations-0.0.4 spec/composed_validations/or_string_joiner_spec.rb
composed_validations-0.0.3 spec/composed_validations/or_string_joiner_spec.rb
composed_validations-0.0.2 spec/composed_validations/or_string_joiner_spec.rb
composed_validations-0.0.1 spec/composed_validations/or_string_joiner_spec.rb