From 8032e50584a171b62e675095c3ae77de918c38e8 Mon Sep 17 00:00:00 2001 From: Diego Araújo + Guilherme Rojas Date: Mon, 18 Feb 2013 15:58:57 -0300 Subject: [PATCH] [Mezuro] Finishing acceptance tests for project feature. --- features/step_definitions/mezuro_steps.rb | 6 +++++- plugins/mezuro/features/project.feature | 69 ++++++++++++++++++++++++++++++++++++++++++++++----------------------- 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/features/step_definitions/mezuro_steps.rb b/features/step_definitions/mezuro_steps.rb index e588523..227847c 100644 --- a/features/step_definitions/mezuro_steps.rb +++ b/features/step_definitions/mezuro_steps.rb @@ -38,10 +38,14 @@ Then /^I should see "([^"]*)" button$/ do |button_name| find_button(button_name).should_not be_nil end +Then /^I should not see "([^"]*)" button$/ do |button_name| + find_button(button_name).should be_nil +end + When /^I have a Mezuro project with the following data$/ do |fields| item = {} fields.rows_hash.each do |name, value| - if(name=="community") + if(name=="community" or name=="user") item.merge!(:profile=>Profile[value]) else item.merge!(name => value) diff --git a/plugins/mezuro/features/project.feature b/plugins/mezuro/features/project.feature index 4d3a227..642f12a 100644 --- a/plugins/mezuro/features/project.feature +++ b/plugins/mezuro/features/project.feature @@ -89,27 +89,50 @@ Feature: Project And I press "Save" Then I should see "Title can't be blank" -# @selenium -# Scenario: I delete a Mezuro project that belongs to me -# Given the following Mezuro project -# | name | description | owner | -# | Sample Project | Sample Description | joaosilva | -# And I am on article "Sample Project" -# And I should be on /joaosilva/sample-project -# When I follow "Delete" -# And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog -# Then I go to /joaosilva/sample-project -# And I should see "There is no such page: /joaosilva/sample-project" -# -# @selenium -# Scenario: I cannot delete a Mezuro project that doesn't belong to me -# Given the following Mezuro project -# | name | description | owner | -# | Sample Project | Sample Description | joaosilva | -# And I am on article "Sample Project" -# And I should be on /joaosilva/sample-project -# When I follow "Delete" -# And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog -# Then I go to /joaosilva/sample-project -# And I should see "There is no such page: /joaosilva/sample-project" + @selenium + Scenario: I try to edit a Mezuro project with title of an existing Mezuro Project + Given I have a Mezuro project with the following data + | name | Sample Project | + | description | Sample Description | + | community | mycommunity | + And I have a Mezuro project with the following data + | name | Another Project | + | description | Another Description | + | community | mycommunity | + And I am on article "Sample Project" + And I should be on /mycommunity/sample-project + And I follow "Edit" + When I update this Mezuro project with the following data + | Title | Another Project | + | Description | Another Description| + And I press "Save" + Then I should see "Slug The title (article name) is already being used by another article, please use another title." + + @selenium + Scenario: I delete a Mezuro project that belongs to me + Given I have a Mezuro project with the following data + | name | Sample Project | + | description | Sample Description | + | community | mycommunity | + And I am on article "Sample Project" + And I should be on /mycommunity/sample-project + When I follow "Delete" + And I confirm the "Are you sure that you want to remove the item "Sample Project"?" dialog + Then I go to /mycommunity/sample-project + And I should see "There is no such page: /mycommunity/sample-project" + + @selenium + Scenario: I cannot edit or delete a Mezuro project that doesn't belong to me + Given I have a Mezuro project with the following data + | name | Sample Project | + | description | Sample Description | + | community | mycommunity | + Given the following users + | login | name | + | adminuser | Admin | + And I am logged in as "adminuser" + And I am on article "Sample Project" + And I should be on /mycommunity/sample-project + And I should not see "Delete" + And I should not see "Edit" -- libgit2 0.21.2