Class: RSpec::XlsxMatchers::FilledRows

Inherits:
BaseSheet
  • Object
show all
Defined in:
lib/rspec/xlsx_matchers/filled_rows.rb

Overview

filled rows count matcher

Instance Attribute Summary collapse

Attributes inherited from BaseSheet

#sheet, #sheet_name, #subject

Instance Method Summary collapse

Methods inherited from BaseSheet

#in_sheet

Methods included from Utils

#force_array, #map_output

Constructor Details

#initialize(count) ⇒ FilledRows

Returns a new instance of FilledRows.



9
10
11
12
# File 'lib/rspec/xlsx_matchers/filled_rows.rb', line 9

def initialize(count)
  super()
  @expected_filled_row_count = count
end

Instance Attribute Details

#expected_filled_row_countObject (readonly)

Returns the value of attribute expected_filled_row_count.



7
8
9
# File 'lib/rspec/xlsx_matchers/filled_rows.rb', line 7

def expected_filled_row_count
  @expected_filled_row_count
end

Instance Method Details

#failure_messageObject



22
23
24
25
26
# File 'lib/rspec/xlsx_matchers/filled_rows.rb', line 22

def failure_message
  return sheet_failure_message if sheet.nil?

  "Expected #{expected_filled_row_count} filled rows but found #{actual_filled_row_count}"
end

#failure_message_when_negatedObject



28
29
30
31
32
# File 'lib/rspec/xlsx_matchers/filled_rows.rb', line 28

def failure_message_when_negated
  return sheet_failure_message if sheet.nil?

  "Expected NOT to find #{expected_filled_row_count} filled rows but did"
end

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# File 'lib/rspec/xlsx_matchers/filled_rows.rb', line 14

def matches?(subject)
  @subject = subject
  @sheet = find_sheet
  return false if sheet.nil?

  actual_filled_row_count == expected_filled_row_count
end