Sha256: a9d8c2ef64482942a217ef56499c91da3cf7ae683a49bac659727cae82ecbc01

Contents?: true

Size: 1.62 KB

Versions: 12

Compression:

Stored size: 1.62 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

		# Setup 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

12 entries across 12 versions & 3 rubygems

Version Path
activeadmin-0.6.6 features/index/index_scope_to.feature
activeadmin-0.6.5 features/index/index_scope_to.feature
activeadmin-0.6.4 features/index/index_scope_to.feature
yousty-activeadmin-1.0.4.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.3.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.2.pre features/index/index_scope_to.feature
activeadmin-0.6.3 features/index/index_scope_to.feature
yousty-activeadmin-1.0.1.pre features/index/index_scope_to.feature
yousty-activeadmin-1.0.0.pre features/index/index_scope_to.feature
activeadmin-0.6.2 features/index/index_scope_to.feature
activeadmin-0.6.1 features/index/index_scope_to.feature
aa-rails4-0.6.0 features/index/index_scope_to.feature