---
...deployables.feature => catalog_entries.feature} | 62 ++++++++++----------
src/features/catalogs.feature | 44 ++++++++++++++
src/features/step_definitions/catalog_steps.rb | 3 +
.../step_definitions/suggested_deployable_steps.rb | 14 ++--
src/spec/factories/catalog.rb | 6 ++
src/spec/factories/suggested_deployable.rb | 7 +-
6 files changed, 96 insertions(+), 40 deletions(-)
rename src/features/{suggested_deployables.feature => catalog_entries.feature} (31%)
create mode 100644 src/features/catalogs.feature
create mode 100644 src/features/step_definitions/catalog_steps.rb
create mode 100644 src/spec/factories/catalog.rb
diff --git a/src/features/suggested_deployables.feature
b/src/features/catalog_entries.feature
similarity index 31%
rename from src/features/suggested_deployables.feature
rename to src/features/catalog_entries.feature
index b9feb6e..3d4ee38 100644
--- a/src/features/suggested_deployables.feature
+++ b/src/features/catalog_entries.feature
@@ -1,36 +1,38 @@
-Feature: Manage Suggested Deployables
- In order to manage suggested deployables
+Feature: Manage Catalog Entries
+ In order to manage catalog entries
As an admin
- I want to add/edit/remove suggested deployables
+ I want to add/edit/remove catalog entries
Background:
Given I am an authorised user
And I am logged in
- Scenario: Create new deployable
- Given I am on the suggested deployables page
- When I follow "new_deployable_button"
- Then I should see "Add New Deployable"
- When I fill in "suggested_deployable[name]" with "test1"
- When I fill in "suggested_deployable[description]" with
"description"
- When I fill in "suggested_deployable[url]" with
"http://random_url"
+ Scenario: Create new catalog entry
+ Given I am on the catalog entries page
+ And there is a "default" catalog
+ When I follow "new_catalog_entry_button"
+ Then I should see "Add New Catalog Entry"
+ When I fill in "catalog_entry[name]" with "test1"
+ When I select "default" from "catalog_entry[catalog_id]"
+ When I fill in "catalog_entry[description]" with "description"
+ When I fill in "catalog_entry[url]" with "http://random_url"
And I press "save_button"
- Then I should see "Deployable added"
+ Then I should see "Catalog entry added"
Scenario: Change the name
- Given a suggested deployable "testdepl" exists
- And I am on the suggested deployables page
+ Given a catalog entry "testdepl" exists
+ And I am on the catalog entries page
When I follow "testdepl"
And I follow "edit_button"
- Then I should see "Editing Deployable"
- When I fill in "suggested_deployable[name]" with
"testdepl-renamed"
+ Then I should see "Editing Catalog Entry"
+ When I fill in "catalog_entry[name]" with "testdepl-renamed"
And I press "save_button"
- Then I should see "Deployable updated successfully!"
+ Then I should see "Catalog entry updated successfully!"
And I should see "testdepl-renamed"
- Scenario: Show deployable details
- Given a suggested deployable "testdepl" exists
- And I am on the suggested deployables page
+ Scenario: Show catalog entry details
+ Given a catalog entry "testdepl" exists
+ And I am on the catalog entries page
When I follow "testdepl"
Then I should see "testdepl"
And I should see "Name"
@@ -38,22 +40,22 @@ Feature: Manage Suggested Deployables
And I should see "url"
Scenario: Delete deployables
- Given a suggested deployable "testdepl1" exists
- And a suggested deployable "testdepl2" exists
- And I am on the suggested deployables page
- When I check "testdepl1" suggested deployable
- And I check "testdepl2" suggested deployable
+ Given a catalog entry "testdepl1" exists
+ And a catalog entry "testdepl2" exists
+ And I am on the catalog entries page
+ When I check "testdepl1" catalog entry
+ And I check "testdepl2" catalog entry
And I press "delete_button"
- Then there should be only 0 suggested deployables
- And I should be on the suggested deployables page
+ Then there should be only 0 catalog entries
+ And I should be on the catalog entries page
And I should not see "testdepl1"
And I should not see "testdepl2"
Scenario: Delete deployable
- Given a suggested deployable "testdepl1" exists
- And I am on the suggested deployables page
+ Given a catalog entry "testdepl1" exists
+ And I am on the catalog entries page
When I follow "testdepl1"
And I press "delete_button"
- Then there should be only 0 suggested deployables
- And I should be on the suggested deployables page
+ Then there should be only 0 catalog entries
+ And I should be on the catalog entries page
And I should not see "testdepl1"
diff --git a/src/features/catalogs.feature b/src/features/catalogs.feature
new file mode 100644
index 0000000..caf11f1
--- /dev/null
+++ b/src/features/catalogs.feature
@@ -0,0 +1,44 @@
+Feature: Manage Catalogs
+ In order to manage catalogs
+ As an admin
+ I want to be able to perform CRUD operations on catalogs
+
+ Background:
+ Given I am an authorised user
+ And I am logged in
+
+ Scenario: Create a new catalog
+ Given I am on the catalogs page
+ And a pool "default" exists
+ And I follow "new_catalog_button"
+ Then I should see "Add New Catalog"
+ And I fill in "catalog_name" with "Finance"
+ And I select "default" from "catalog_pool_id"
+ And I press "Save"
+ Then I should be on the catalogs page
+ And I should see "Finance"
+
+ Scenario: Show catalog details
+ Given there is a "Marketing" catalog
+ And I am on the catalogs page
+ When I follow "Marketing"
+ Then I should see "Name: Marketing"
+
+ Scenario: Edit a catalog
+ Given there is a "Development" catalog
+ And I am on the catalogs page
+ When I follow "Development"
+ And I follow "edit_button"
+ And I fill in "Engineering" for "catalog[name]"
+ And I press "Save"
+ Then I should be on the catalogs page
+ And I should see "Engineering"
+ And I should not see "Development"
+
+ Scenario: Delete a catalog
+ Given there is a "Bad" catalog
+ And I am on the catalogs page
+ When I follow "Bad"
+ And I press "Delete"
+ Then I should be on the catalogs page
+ And I should not see "Bad"
\ No newline at end of file
diff --git a/src/features/step_definitions/catalog_steps.rb
b/src/features/step_definitions/catalog_steps.rb
new file mode 100644
index 0000000..bcc87c0
--- /dev/null
+++ b/src/features/step_definitions/catalog_steps.rb
@@ -0,0 +1,3 @@
+Given /^there is a "([^"]*)" catalog$/ do |name|
+ FactoryGirl.create :catalog, :name => name
+end
\ No newline at end of file
diff --git a/src/features/step_definitions/suggested_deployable_steps.rb
b/src/features/step_definitions/suggested_deployable_steps.rb
index c17b0d5..d6bf3e3 100644
--- a/src/features/step_definitions/suggested_deployable_steps.rb
+++ b/src/features/step_definitions/suggested_deployable_steps.rb
@@ -1,12 +1,12 @@
-Given /^a suggested deployable "([^"]*)" exists$/ do |arg1|
- FactoryGirl.create :suggested_deployable, :name => arg1
+Given /^a catalog entry "([^"]*)" exists$/ do |arg1|
+ FactoryGirl.create :catalog_entry, :name => arg1
end
-When /^I check "([^"]*)" suggested deployable$/ do |arg1|
- dep = SuggestedDeployable.find_by_name(arg1)
- check("suggested_deployable_checkbox_#{dep.id}")
+When /^I check "([^"]*)" catalog entry$/ do |arg1|
+ dep = CatalogEntry.find_by_name(arg1)
+ check("catalog_entry_checkbox_#{dep.id}")
end
-Then /^there should be only (\d+) suggested deployables$/ do |arg1|
- SuggestedDeployable.count.should == arg1.to_i
+Then /^there should be only (\d+) catalog entries$/ do |arg1|
+ CatalogEntry.count.should == arg1.to_i
end
diff --git a/src/spec/factories/catalog.rb b/src/spec/factories/catalog.rb
new file mode 100644
index 0000000..41204df
--- /dev/null
+++ b/src/spec/factories/catalog.rb
@@ -0,0 +1,6 @@
+FactoryGirl.define do
+ factory :catalog do
+ sequence(:name) { |n| "catalog#{n}" }
+ association :pool, :factory => :pool
+ end
+end
diff --git a/src/spec/factories/suggested_deployable.rb
b/src/spec/factories/suggested_deployable.rb
index 9669d5f..cac06b8 100644
--- a/src/spec/factories/suggested_deployable.rb
+++ b/src/spec/factories/suggested_deployable.rb
@@ -1,8 +1,9 @@
FactoryGirl.define do
- factory :suggested_deployable do
- sequence(:name) { |n| "suggested_deployable#{n}" }
+ factory :catalog_entry do
+ sequence(:name) { |n| "catalog_entry#{n}" }
url "http://url_to_deployable"
- description "suggested deployable description"
+ description "catalog entry description"
association :owner, :factory => :user
+ association :catalog, :factory => :catalog
end
end
--
1.7.6