Sha256: 86974a65bf4febfd0f16905a35cf043aa4b2702c1de8cc8d11cc9b6bdad2ee63

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

require_relative "xlsx_matchers/version"
require_relative "xlsx_matchers/exact_match"
require_relative "xlsx_matchers/in_row"
require_relative "xlsx_matchers/in_column"
require_relative "xlsx_matchers/utils"
require_relative "xlsx_matchers/base_sheet"

require_relative "xlsx_matchers/sheets"
require_relative "xlsx_matchers/columns"
require_relative "xlsx_matchers/empty_row"
require_relative "xlsx_matchers/cells"
require_relative "xlsx_matchers/cell_value"

begin
  require "roo"
rescue LoadError
  # optional dependency
end

begin
  require "caxlsx"
rescue LoadError
  # optional dependency
end
module RSpec
  # # RSpec::XlsxMatchers adds the following matchers to rspec
  #  - have_excel_sheets
  #  - have_excel_columns
  #  - have_excel_column
  #  - have_excel_empty_row
  #  - have_excel_cells
  #  - have_excel_cell_value
  module XlsxMatchers
    # class Error < StandardError; end

    def have_excel_sheets(sheet_names)
      Sheets.new(sheet_names)
    end

    def have_excel_columns(column_names)
      Columns.new(column_names)
    end

    def have_excel_column(column_name)
      raise ArgumentError, "Column name should not be an Array" if column_name.is_a?(Array)

      Columns.new([column_name])
    end

    def have_excel_empty_row(index)
      EmptyRow.new(index)
    end

    def have_excel_cells(cells)
      Cells.new(cells)
    end

    def have_excel_cell_value(value)
      CellValue.new(value)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-xlsx_matchers-0.1.4 lib/rspec/xlsx_matchers.rb
rspec-xlsx_matchers-0.1.3 lib/rspec/xlsx_matchers.rb
rspec-xlsx_matchers-0.1.2 lib/rspec/xlsx_matchers.rb
rspec-xlsx_matchers-0.1.1 lib/rspec/xlsx_matchers.rb
rspec-xlsx_matchers-0.1.0 lib/rspec/xlsx_matchers.rb