Class: RSpec::XlsxMatchers::Sheets
- Inherits:
-
Object
- Object
- RSpec::XlsxMatchers::Sheets
- Includes:
- Utils
- Defined in:
- lib/rspec/xlsx_matchers/sheets.rb
Overview
have_excel_sheets
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#expected_sheet_names ⇒ Object
readonly
Returns the value of attribute expected_sheet_names.
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(expected_sheet_names) ⇒ Sheets
constructor
A new instance of Sheets.
- #matches?(subject) ⇒ Boolean
Methods included from Utils
Constructor Details
#initialize(expected_sheet_names) ⇒ Sheets
Returns a new instance of Sheets.
10 11 12 13 |
# File 'lib/rspec/xlsx_matchers/sheets.rb', line 10 def initialize(expected_sheet_names) @expected_sheet_names = force_array expected_sheet_names @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/rspec/xlsx_matchers/sheets.rb', line 8 def errors @errors end |
#expected_sheet_names ⇒ Object (readonly)
Returns the value of attribute expected_sheet_names.
8 9 10 |
# File 'lib/rspec/xlsx_matchers/sheets.rb', line 8 def expected_sheet_names @expected_sheet_names end |
Instance Method Details
#failure_message ⇒ Object
27 28 29 |
# File 'lib/rspec/xlsx_matchers/sheets.rb', line 27 def "Xlsx file sheets not found: #{errors.map { |s| "'#{s}'" }.join(",")}" end |
#matches?(subject) ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rspec/xlsx_matchers/sheets.rb', line 15 def matches?(subject) if subject.is_a?(String) || subject.is_a?(File) match_string(subject) elsif defined?(Roo::Excelx) && subject.is_a?(Roo::Excelx) match_roo_excelx(subject) elsif defined?(Axlsx) matches_axlsx?(subject) else invalid_file end end |