Sha256: 432e6fcb8f87795edd9e7ec4e3d30ddc87d184106e2e756efbb2c79bd621c2a2

Contents?: true

Size: 1.6 KB

Versions: 159

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

159 entries across 159 versions & 1 rubygems

Version Path
pact_broker-1.14.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.13.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.12.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.11.2 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.11.1 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.11.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.10.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.9.3 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.9.2 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.9.1 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.9.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.9.0.rc1 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.8.1 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.8.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.7.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.6.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.5.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.4.0 spec/lib/pact_broker/db/validate_encoding_spec.rb
pact_broker-1.3.2.rc1 spec/lib/pact_broker/db/validate_encoding_spec.rb