Sha256: b55d59c868cb9412faa00ee90a0b6f63eebb4044e3b6494f5611906878af83ac

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

module Features
  module Pagination
    def paginates(factory:, increment:, selector:, attributes:{})
      factory_string = factory.to_s
      factory = factory_string.underscore.to_sym
      factory_plural = factory_string.pluralize.underscore.to_sym
      number_of_results_for_two_pages = increment + 1
      results = 
        FactoryBot.
        create_list(factory,
                    number_of_results_for_two_pages,
                    attributes)

      yield
      expect(page).to have_selector(selector, count: increment)
      click_on('Next')

      expect(page).to have_selector(selector, count: 1)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exposition-0.0.5.7.pre.alpha spec/support/features/pagination.rb
exposition-0.0.5.6.pre.alpha spec/support/features/pagination.rb