Sha256: 9457f218ab692c50ba81e4b75aea2627ac8f61a5937b1d452052d9765f1a93c4

Contents?: true

Size: 1.6 KB

Versions: 12

Compression:

Stored size: 1.6 KB

Contents

require "pact_broker/db/validate_encoding"
require "pact_broker/db"

module PactBroker
  module DB

    describe ValidateEncoding do

      let(:opts) { {encoding: encoding} }
      let(:connection) { double("connection", opts: opts)}

      subject { ValidateEncoding.(connection) }

      describe ".call" do
        context "when encoding is UTF8" do
          let(:encoding) { "UTF8" }

          it "does not raise an error" do
            subject
          end
        end

        context "when encoding is UTF8" do
          let(:encoding) { "utf8" }

          it "does not raise an error" do
            subject
          end
        end

        context "when encoding is utf-8" do
          let(:encoding) { "utf-8" }

          it "does not raise an error" do
            subject
          end
        end

        context "when encoding is utf-80" do
          let(:encoding) { "utf-80" }

          it "does not raise an error, maybe it should, ah well" do
            subject
          end
        end

        context "when encoding is null" do
          let(:encoding) { nil }

          it "raises an error" do
            expect{ subject }.to raise_error ConnectionConfigurationError, /The Sequel connection encoding \(nil\) is strongly recommended to be "utf8"/
          end
        end

        context "when encoding is latin1" do
          let(:encoding) { "latin1" }

          it "raises an error" do
            expect{ subject }.to raise_error ConnectionConfigurationError, /The Sequel connection encoding \("latin1"\) is strongly recommended to be "utf8"/
          end
        end
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.89.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.88.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.87.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.86.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.85.1 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.85.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.84.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.83.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.82.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.81.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-2.80.0 spec/lib/pact_broker/db/validate_encoding_spec.rb