Skip to content

Instantly share code, notes, and snippets.

@suchov
Created April 12, 2017 16:44
Show Gist options
  • Save suchov/9530fca00899db3e6c3f17ed40ff5055 to your computer and use it in GitHub Desktop.
Save suchov/9530fca00899db3e6c3f17ed40ff5055 to your computer and use it in GitHub Desktop.

Revisions

  1. suchov created this gist Apr 12, 2017.
    17 changes: 17 additions & 0 deletions Helper Methods
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    Common helper methods should be extracted to `spec/support`, where they can be
    organized by utility and automatically included into a specific subset of the tests.

    # spec/support/kaminari_helper.rb
    module KaminariHelper
    def with_kaminari_per_page(value, &block)
    old_value = Kaminari.config.default_per_page
    Kaminari.config.default_per_page = value
    block.call
    ensure
    Kaminari.config.default_per_page = old_value
    end
    end

    RSpec.configure do |config|
    config.include KaminariHelper, type: :request
    end