Sha256: 7fba14852bd787eab71c21d5d691a03d7862e4cd26181039a4fd8a915fd7a44e

Contents?: true

Size: 1.8 KB

Versions: 7

Compression:

Stored size: 1.8 KB

Contents

@dsl @wip
Feature: Custom actions

  Background:
    Given I am logged in
    And 1 product exists

  Scenario: Custom member action
    Given a configuration of:
      """
      class AbAdminProduct < AbAdmin::AbstractResource
        action_item do
          link_to 'Custom action', action_item_admin_path(:custom), method: :post
        end

        member_action :custom, method: :post do
          flash[:notice] = 'Custom action done!'
          redirect_to resource_path
        end
      end
      """
    And I am on the admin product page
    When I click "Custom action"
    Then I should see "Custom action done!"
    And I should be on the admin product page

  Scenario: Custom member action http verb check
    Given a configuration of:
      """
      class AbAdminProduct < AbAdmin::AbstractResource
        action_item do
          link_to 'Custom action', action_item_admin_path(:custom)
        end

        member_action :custom, method: :post do
          flash[:notice] = 'Custom action done!'
          redirect_to resource_path
        end
      end
      """
    And I am on the admin product page
    When I should see routing error when follow "Custom action"

  Scenario: Custom collection action
    Given a configuration of:
      """
      class AbAdminProduct < AbAdmin::AbstractResource
        action_item do
          link_to 'Custom collection action', action_item_admin_path(:custom_collection), method: :post
        end

        collection_action :custom_collection, method: :post do
          flash[:notice] = 'Custom collection action done!'
          redirect_to collection_path
        end
      end
      """
    And I am on the admin products page
    When I click "Custom collection action"
    Then I should see "Custom collection action done!"
    And I should be on the admin products page

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.3.6 features/dsl/custom_actions.feature
ab_admin-0.3.5 features/dsl/custom_actions.feature
ab_admin-0.3.4 features/dsl/custom_actions.feature
ab_admin-0.3.3 features/dsl/custom_actions.feature
ab_admin-0.3.2 features/dsl/custom_actions.feature
ab_admin-0.3.1 features/dsl/custom_actions.feature
ab_admin-0.3.0 features/dsl/custom_actions.feature