Created
May 12, 2012 23:25
-
-
Save bhserna/2669687 to your computer and use it in GitHub Desktop.
Refactoring my old cucumber tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Manage categories | |
In order to clasify the brand products | |
As an admin | |
I want to assign categories to a product | |
Scenario: Manage product categories | |
Given a brand with a category and a product | |
And I am an admin | |
When I add the brand category to the product | |
Then I see the category in the product | |
When I remove the category of the product | |
Then I don't see the category in the product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given "a brand with a category and a product" do | |
@brand = Factory :brand_with_category_and_product | |
@category = @brand.categories.first | |
@product = @brand.products.first | |
end | |
When "I add the brand category to the product" do | |
visit new_product_category_path(@product) | |
select @category.name, from: "Category" | |
click_button "Add brand category" | |
end | |
Then "I see the category in the product" do | |
within "#brand-categories" do | |
page.should have_content @category.name | |
end | |
end | |
When "I remove the category of the product" do | |
click_link "Remove" | |
end | |
Then "I don't see the category in the product" do | |
page.should_not have_content @category.name | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Manage categories | |
In order to clasify the brand products | |
As an admin | |
I want to assign categories to a product | |
Background: | |
Given the following brand records | |
| name | description | | |
| GP:50 | GP:50 description | | |
| Zenith Pumps | Zenith Pumps description | | |
And the following product records of "GP:50" | |
| name | description | | |
| Medidor de Presion 311 | Descripcion del medidor | | |
| Medidor de Presion Melt | Descrpcion del medidor melt | | |
And the following category records for the brand "GP:50" | |
| name | | |
| Melt Pressure | | |
| Industrial | | |
And the following category record | |
| name | | |
| Pressure Transducer | | |
And I add the category "Melt Pressure" to the product "Medidor de Presion Melt" | |
And I add the category "Pressure Transducer" to the product "Medidor de Presion Melt" | |
Scenario: Watching the product categories | |
Given I am an admin | |
When I go to admin dashboard | |
And I follow "Marcas" | |
And I follow "GP:50" | |
And I follow "Productos" within "#admin-brand-menu" | |
And I follow "Medidor de Presion Melt" | |
And I follow "Categorías" within "#admin-product-menu" | |
Then I should see "Melt Pressure" within "#brand-categories" | |
And I should see "Pressure Transducer" within "#jazz-categories" | |
Scenario: Add a brand category | |
Given I am an admin | |
When I go to admin dashboard | |
And I follow "Marcas" | |
And I follow "GP:50" | |
And I follow "Productos" within "#admin-brand-menu" | |
And I follow "Medidor de Presion 311" | |
And I follow "Categorías" within "#admin-product-menu" | |
And I follow "Add Brand Category" | |
And I select "Industrial" from "Category" | |
And I press "Add brand category" | |
Then I should see "Industrial" within "#brand-categories" | |
Scenario: Remove a category | |
Given I am an admin | |
When I go to admin dashboard | |
And I follow "Marcas" | |
And I follow "GP:50" | |
And I follow "Productos" within "#admin-brand-menu" | |
And I follow "Medidor de Presion Melt" | |
And I follow "Categorías" within "#admin-product-menu" | |
And I follow "Remove" | |
Then I should not see "Melt Pressure" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment