Class: RSpec::XlsxMatchers::Columns

Inherits:
BaseSheet
  • Object
show all
Includes:
ExactMatch
Defined in:
lib/rspec/xlsx_matchers/columns.rb

Overview

have_excel_columns / have_excel_column

Instance Attribute Summary collapse

Attributes included from ExactMatch

#exact_match

Attributes inherited from BaseSheet

#sheet, #sheet_name, #subject

Instance Method Summary collapse

Methods included from ExactMatch

#exactly

Methods inherited from BaseSheet

#in_sheet, #matches?

Methods included from Utils

#force_array, #map_output

Constructor Details

#initialize(expected_columns) ⇒ Columns

Returns a new instance of Columns.



10
11
12
13
14
15
16
# File 'lib/rspec/xlsx_matchers/columns.rb', line 10

def initialize(expected_columns)
  super()
  @expected_columns = force_array(expected_columns)
  @missing_columns = []
  @extra_columns = []
  @actual_columns = []
end

Instance Attribute Details

#actual_columnsObject (readonly)

Returns the value of attribute actual_columns.



8
9
10
# File 'lib/rspec/xlsx_matchers/columns.rb', line 8

def actual_columns
  @actual_columns
end

#expected_columnsObject (readonly)

Returns the value of attribute expected_columns.



8
9
10
# File 'lib/rspec/xlsx_matchers/columns.rb', line 8

def expected_columns
  @expected_columns
end

#extra_columnsObject (readonly)

Returns the value of attribute extra_columns.



8
9
10
# File 'lib/rspec/xlsx_matchers/columns.rb', line 8

def extra_columns
  @extra_columns
end

#missing_columnsObject (readonly)

Returns the value of attribute missing_columns.



8
9
10
# File 'lib/rspec/xlsx_matchers/columns.rb', line 8

def missing_columns
  @missing_columns
end

Instance Method Details

#failure_messageObject



18
19
20
21
22
23
24
# File 'lib/rspec/xlsx_matchers/columns.rb', line 18

def failure_message
  return sheet_failure_message if sheet.nil?

  msg = failure_message_in_sheet("Columns mismatch")

  "#{msg}:\n\t#{column_failure_message}"
end