Sha256: 99930e2c5bbb6c861bce1f7de9daa72f1a2b7fe71baa6e901a8c0ca084f2b96b

Contents?: true

Size: 1.67 KB

Versions: 30

Compression:

Stored size: 1.67 KB

Contents

Feature: Index Scope To

  Viewing resource configs scoped to another object

  Background:
    Given 10 posts exist
    And a post with the title "Hello World" written by "John Doe" exists
    And a published post with the title "Hello World" written by "John Doe" exists
    Given an index configuration of:
      """
      ActiveAdmin.register Post do
        # Scope section to a specific author
        scope_to do
          User.find_by_first_name_and_last_name "John", "Doe"
        end

        # Set up some scopes
        scope :all, default: true
        scope :published do |posts|
          posts.where "published_at IS NOT NULL"
        end
      end
      """

  Scenario: Viewing the default scope counts
    When I am on the index page for posts
    Then I should see the scope "All" selected
    And I should see the scope "All" with the count 2
    And I should see 2 posts in the table

    When I follow "Published"
    Then I should see 1 posts in the table

  Scenario: Viewing the index with conditional scope :if
    Given an index configuration of:
      """
      ActiveAdmin.register Post do
        scope_to :if => proc{ false } do
          User.find_by_first_name_and_last_name("John", "Doe")
        end
      end
      """
    When I am on the index page for posts
    Then I should see 12 posts in the table

  Scenario: Viewing the index with conditional scope :unless
    Given an index configuration of:
      """
      ActiveAdmin.register Post do
        scope_to :unless => proc{ true } do
          User.find_by_first_name_and_last_name("John", "Doe")
        end
      end
      """
    When I am on the index page for posts
    Then I should see 12 posts in the table

Version data entries

30 entries across 30 versions & 6 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/features/index/index_scope_to.feature
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/features/index/index_scope_to.feature
yousty-activeadmin-1.0.17.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.16.pre features/index/index_scope_to.feature
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/features/index/index_scope_to.feature
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/features/index/index_scope_to.feature
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/features/index/index_scope_to.feature
yousty-activeadmin-1.0.15.pre features/index/index_scope_to.feature
activeadmin-orac-1.0.0.pre4 features/index/index_scope_to.feature
activeadmin-orac-1.0.0 features/index/index_scope_to.feature
activeadmin-orac-1.0.0.pre.orac features/index/index_scope_to.feature
yousty-activeadmin-1.0.14.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.13.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.12.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.11.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.10.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.9.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.8.pre features/index/index_scope_to.feature
activeadmin-1.0.0.pre4 features/index/index_scope_to.feature
activeadmin-1.0.0.pre3 features/index/index_scope_to.feature