Sha256: 5c3d27aff2596faac02a8b91d8b6d9e97749c45b4201a57c570a06123cbd7308

Contents?: true

Size: 1.78 KB

Versions: 12

Compression:

Stored size: 1.78 KB

Contents

Feature: Index Scoping

  Viewing resources and scoping them

  Scenario: Viewing resources with one scope and no default
    Given 10 posts exist
    And an index configuration of:
      """
      ActiveAdmin.register Post do
        scope :all
      end
      """
    Then I should see the scope "All" not selected
    And I should see the scope "All" with the count 10
    And I should see 10 posts in the table

  Scenario: Viewing resources with one scope as the default
    Given 10 posts exist
    And an index configuration of:
      """
      ActiveAdmin.register Post do
        scope :all, :default => true
      end
      """
    Then I should see the scope "All" selected
    And I should see the scope "All" with the count 10
    And I should see 10 posts in the table

  Scenario: Viewing resources with mulitple scopes as blocks
    Given 10 posts exist
    And an index configuration of:
      """
      ActiveAdmin.register Post do
        scope 'Today', :default => true do |posts|
          posts.where(["created_at > ? AND created_at < ?", ::Time.zone.now.beginning_of_day, ::Time.zone.now.end_of_day])
        end
        scope 'Tomorrow' do |posts|
          posts.where(["created_at > ? AND created_at < ?", ::Time.zone.now.beginning_of_day + 1.day, ::Time.zone.now.end_of_day + 1.day])
        end
      end
      """
    Then I should see the scope "Today" selected
    And I should see the scope "Tomorrow" not selected
    And I should see the scope "Today" with the count 10
    And I should see the scope "Tomorrow" with the count 0
    And I should see 10 posts in the table
    And I should see a link to "Tomorrow"

    When I follow "Tomorrow"
    Then I should see the scope "Tomorrow" selected
    And I should see the scope "Today" not selected
    And I should see a link to "Today"

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
andrewroth_activeadmin-0.3.4 features/index/index_scopes.feature
activeadmin-0.3.4 features/index/index_scopes.feature
activeadmin-0.3.3 features/index/index_scopes.feature
activeadmin-0.3.2 features/index/index_scopes.feature
activeadmin-0.3.1 features/index/index_scopes.feature
activeadmin-0.3.0 features/index/index_scopes.feature
nsm-activeadmin-0.2.2 features/index/index_scopes.feature
saulolso-activeadmin-0.2.2.1 features/index/index_scopes.feature
saulolso-activeadmin-0.2.2 features/index/index_scopes.feature
activeadmin-0.2.2 features/index/index_scopes.feature
activeadmin-0.2.1 features/index/index_scopes.feature
activeadmin-0.2.0 features/index/index_scopes.feature