Sha256: 8922a3d329f0d806d9ba142109ea7efb018418ad1e6511858e84213d0ecf06b6

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

require "spec_helper"
require "expressir/express_exp/parser"
require "expressir/express_exp/formatter"
require "expressir/express_exp/schema_head_formatter"

RSpec.describe Expressir::ExpressExp::SchemaHeadFormatter do
  describe ".format" do
    it "formats schema head" do
      repo = Expressir::ExpressExp::Parser.from_file(sample_file)

      class CustomFormatter < Expressir::ExpressExp::Formatter
        include Expressir::ExpressExp::SchemaHeadFormatter
      end
      result = CustomFormatter.format(repo)

      expect(result).to eq(<<~EXP.strip
        SCHEMA syntax_schema 'version';
        USE FROM contract_schema;
        USE FROM contract_schema
          (contract);
        USE FROM contract_schema
          (contract, contract2);
        USE FROM contract_schema
          (contract AS contract2);
        REFERENCE FROM contract_schema;
        REFERENCE FROM contract_schema
          (contract);
        REFERENCE FROM contract_schema
          (contract, contract2);
        REFERENCE FROM contract_schema
          (contract AS contract2);
      EXP
      )
    end
  end

  def sample_file
    @sample_file ||= Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
expressir-0.2.16 spec/expressir/express_exp/schema_head_formatter_spec.rb
expressir-0.2.16-x86_64-linux spec/expressir/express_exp/schema_head_formatter_spec.rb
expressir-0.2.16-x86_64-darwin spec/expressir/express_exp/schema_head_formatter_spec.rb
expressir-0.2.16-x86-mingw32 spec/expressir/express_exp/schema_head_formatter_spec.rb
expressir-0.2.16-x86-linux spec/expressir/express_exp/schema_head_formatter_spec.rb
expressir-0.2.16-x64-mingw32 spec/expressir/express_exp/schema_head_formatter_spec.rb
expressir-0.2.16-arm64-darwin spec/expressir/express_exp/schema_head_formatter_spec.rb