Sha256: b60e6541256f61843a935378922ea960f9e87397d881ffcc1c6a4c03974ceb0a

Contents?: true

Size: 1.97 KB

Versions: 7

Compression:

Stored size: 1.97 KB

Contents

@dsl
Feature: Table index view

  Background:
    Given I am logged in
    And products exists with attributes:
      | sku  | price | name  |
      | t-12 | 234   | Table |
      | dc_1 | 12    | Chair |

  Scenario: Table columns
    Given a configuration of:
      """
      class AbAdminProduct < AbAdmin::AbstractResource
        table do
          field :sku
          field :name
        end
      end
      """
    When I am on the admin products page
    Then I should see list of products

  Scenario: Columns data formatting
    Given a configuration of:
      """
      class AbAdminProduct < AbAdmin::AbstractResource
        table do
          field :sku
          field :price
          field(:picture) { |item| item_image_link(item) }
          field :created_at
          field :is_visible
          field :collection
        end
      end
      """
    When I am on the admin products page
    Then I should see pretty formatted products

  Scenario Outline: Sortable columns
    Given a configuration of:
      """
      class AbAdminProduct < AbAdmin::AbstractResource
        table do
          field :price
          field <config>
        end
      end
      """
    And I am on the admin products page
    When I follow "<column>"
    Then I should see products ordered by "<ordering>"

  Examples:
    | column | config                                                            | ordering   |
    | Sku    | :sku                                                              | sku        |
    | Name   | :name, :sortable => :id                                           | id         |
    | Name   | :name, :sortable => {:column => :price, :default_order => 'desc'} | price desc |

  Scenario: Disabled sortable column
    Given a configuration of:
      """
      class AbAdminProduct < AbAdmin::AbstractResource
        table do
          field :created_at, :sortable => false
        end
      end
      """
    And I am on the admin products page
    Then I should not see "Created at" link

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.2.3 features/dsl/table.feature
ab_admin-0.2.2 features/dsl/table.feature
ab_admin-0.2.1 features/dsl/table.feature
ab_admin-0.2.0 features/dsl/table.feature
ab_admin-0.1.2 features/dsl/table.feature
ab_admin-0.1.1 features/dsl/table.feature
ab_admin-0.1.0 features/dsl/table.feature