Sha256: 6dcb54290652be2307a8c5033a86d27b2878823d80e771059669b7aaafdccb12

Contents?: true

Size: 1.46 KB

Versions: 10

Compression:

Stored size: 1.46 KB

Contents

Given(/^the user goes on the new expense category page$/) do
  visit dorsale.expense_gun_categories_path
  find(".link_create").click
end

When(/^he fills the category's information$/) do
  fill_in "category_name", with: "Category Name"
  fill_in "category_code", with: "Category Code"
  select "Oui"
end

When(/^creates a new expense category$/) do
  find("[type=submit]").click
end

Then(/^the category is added to the category list$/) do
  expect(page).to have_content "Category Name"
  expect(page).to have_content "Category Code"
  expect(page).to have_css(".fa-check")
end

Given(/^an existing expense category$/) do
  @category = create(:expense_gun_category, vat_deductible: true)
end

When(/^I edit the expense category$/) do
  visit dorsale.expense_gun_categories_path
  find(".link_update").click
end

Then(/^the current expense category's label should be pre-filled$/) do
  expect(page).to have_field("category_name", with: @category.name)
end

When(/^he validates the new expense category$/) do
  fill_in "category_name", with: "New Category Name"
  fill_in "category_code", with: "New Category Code"
  select "Non"
  find("[type=submit]").click
end

Then(/^he is redirected on the expense categories page$/) do
  expect(current_path).to eq dorsale.expense_gun_categories_path
end

Then(/^the expense category's label is updated$/) do
  expect(page).to have_content "New Category Name"
  expect(page).to have_content "New Category Code"
  expect(page).to have_css(".fa-remove")
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dorsale-4.0.0 features/step_definitions/expense_gun_categories_steps.rb
dorsale-3.20.0 features/step_definitions/expense_gun_categories_steps.rb
dorsale-3.19.1 features/step_definitions/expense_gun_categories_steps.rb
dorsale-3.19.0 features/step_definitions/expense_gun_categories_steps.rb
dorsale-3.18.0 features/step_definitions/expense_gun_categories_steps.rb
dorsale-3.17.0 features/step_definitions/expense_gun_categories_steps.rb
dorsale-3.16.0 features/step_definitions/expense_gun_categories_steps.rb
dorsale-3.15.0 features/step_definitions/expense_gun_categories_steps.rb
dorsale-3.14.11 features/step_definitions/expense_gun_categories_steps.rb
dorsale-3.14.10 features/step_definitions/expense_gun_categories_steps.rb