Sha256: 633dd6db6d60be9c04d400387e58f2738befb22661f2eb371e021d60b12dc407

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

Feature: Specifying Actions

  Specifying which actions to allow on my resource

  @allow-rescue
  Scenario: Only creating the index action
    Given a configuration of:
      """
        ActiveAdmin.register Post do
          actions :index
        end
      """
	And I am logged in
    And a post with the title "Hello World" exists
    When I am on the index page for posts
    Then an "AbstractController::ActionNotFound" exception should be raised when I follow "View"

  Scenario: Specify a custom collection action with template
    Given a configuration of:
      """
        ActiveAdmin.register Post do
          action_item(:only => :index) do
            link_to('Import Posts', import_admin_posts_path)
          end

          collection_action :import
        end
      """
    Given "app/views/admin/posts/import.html.erb" contains:
      """
        <p>We are currently working on this feature...</p>
      """
    And I am logged in
    When I am on the index page for posts
    And I follow "Import"
    Then I should see "We are currently working on this feature"

  Scenario: Specify a custom member action with template
    Given a configuration of:
      """
        ActiveAdmin.register Post do
          action_item(:only => :show) do
            link_to('Review', review_admin_post_path)
          end

          member_action :review do
            @post = Post.find(params[:id])
          end
        end
      """
    Given "app/views/admin/posts/review.html.erb" contains:
      """
        <h1>Review: <%= @post.title %></h1>
      """
    And I am logged in
    And a post with the title "Hello World" exists
    When I am on the index page for posts
    And I follow "View"
    And I follow "Review"
    Then I should see "Review: Hello World"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saulolso-activeadmin-0.2.2.1 features/specifying_actions.feature
saulolso-activeadmin-0.2.2 features/specifying_actions.feature