Sha256: e39c46504b83ebbcd2a70b2cae507d8953ef18daf7b7ba0daba6e95ef9620ea4

Contents?: true

Size: 467 Bytes

Versions: 2

Compression:

Stored size: 467 Bytes

Contents

module Controllers
  module Pagination
    def paginates(factory:, increment:)
      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)

      yield

      expect(assigns(factory_plural).count).to eq(increment)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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