Sha256: a48d67b28d51426a3d3c83319b22bd3766806ad297a3231495994261313cda3d

Contents?: true

Size: 990 Bytes

Versions: 59

Compression:

Stored size: 990 Bytes

Contents

require 'pact_broker/client/matrix/text_formatter'

module PactBroker
  module Client
    describe Matrix::TextFormatter do
      let(:matrix_lines) { JSON.parse(File.read('spec/support/matrix.json'), symbolize_names: true)[:matrix] }
      let(:expected_matrix_lines) { File.read('spec/support/matrix.txt') }

      # SublimeText removes whitespace from the end of files when you save them,
      # so removing trailing whitespace before comparing
      subject { Matrix::TextFormatter.call(matrix: matrix_lines).split("\n").collect(&:strip).join("\n") }

      context "with valid data" do
        it "it has the right text" do
          expect(subject).to eq expected_matrix_lines
        end
      end

      context "with invalid data" do
        let(:expected_matrix_lines) { File.read('spec/support/matrix_error.txt') }
        let(:matrix_lines) { [{}] }

        it "doesn't blow up" do
          expect(subject).to eq expected_matrix_lines
        end
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
pact_broker-client-1.34.0 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.33.0 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.32.0 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.31.0 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.30.0 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.29.1 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.29.0 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.28.4 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.28.3 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.28.2 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.28.1 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.28.0 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.27.28 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.27.27 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.27.26 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.27.25 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.27.24 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.27.23 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.27.22 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb
pact_broker-client-1.27.21 spec/lib/pact_broker/client/matrix/text_formatter_spec.rb