From: Imre Farkas <[email protected]> --- src/features/provider_priority_group.feature | 40 ++++++++++++++++++++++ .../provider_priority_group_steps.rb | 20 +++++++++++ src/features/support/paths.rb | 4 ++- src/spec/factories/provider_priority_group.rb | 25 ++++++++++++++ 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 src/features/provider_priority_group.feature create mode 100644 src/features/step_definitions/provider_priority_group_steps.rb create mode 100644 src/spec/factories/provider_priority_group.rb
diff --git a/src/features/provider_priority_group.feature b/src/features/provider_priority_group.feature new file mode 100644 index 0000000..0b78d9f --- /dev/null +++ b/src/features/provider_priority_group.feature @@ -0,0 +1,40 @@ +Feature: Manage Provider Priority Groups + + Background: + Given I am an authorised user + And I am logged in + + Scenario: List a Provider Priority Group + Given a pool "testpool" exists + And there is a provider priority group named "testproviderprioritygroup" for pool "testpool" + When I am on the testpool's provider priority groups page + Then I should see "testpool" + + Scenario: Create a new Provider Priority Group + Given a pool "testpool" exists + And there is a provider named "testprovider" + And there is a provider account named "testprovideraccount" + And I am on the testpool's provider priority groups page + When I follow "Add new" + And I fill in "provider_priority_group_name" with "testproviderprioritygroup" + And I fill in "provider_priority_group_score" with "50" + And I check "provider_account_ids_" + And I press "provider_priority_group_submit" + Then I should see "Priority Group successfully created" + + Scenario: Tries to create a new Provider Priority Group with invalid input data + Given a pool "testpool" exists + And there is a provider named "testprovider" + And there is a provider account named "testprovideraccount" + And I am on the testpool's provider priority groups page + When I follow "Add new" + And I press "provider_priority_group_submit" + Then I should not see "Priority Group successfully created" + And I should see "Score is not a number" + + Scenario: Delete a Provider Priority Group + Given a pool "testpool" exists + And there is a provider priority group named "testproviderprioritygroup" for pool "testpool" + And I am on the testpool's provider priority groups page + When I follow "Delete" + Then I should see "Priority Group successfully deleted" diff --git a/src/features/step_definitions/provider_priority_group_steps.rb b/src/features/step_definitions/provider_priority_group_steps.rb new file mode 100644 index 0000000..9a47e6a --- /dev/null +++ b/src/features/step_definitions/provider_priority_group_steps.rb @@ -0,0 +1,20 @@ +# +# Copyright 2012 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +Given /^there is a provider priority group named "([^"]*)" for pool "([^"]*)"$/ do |priority_group_name, pool_name| + @pool = Pool.find_by_name(pool_name) + @priority_group = FactoryGirl.create(:provider_priority_group, :pool => @pool, :name => priority_group_name) +end \ No newline at end of file diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb index f809a8c..fb6dc83 100644 --- a/src/features/support/paths.rb +++ b/src/features/support/paths.rb @@ -188,7 +188,6 @@ module NavigationHelpers when /^the "(.*)" catalog page/ url_for catalog_path(Catalog.find_by_name($1)) - when /^the "(.*)" catalog catalog entries page/ url_for catalog_deployables_path(Catalog.find_by_name($1)) @@ -199,6 +198,9 @@ module NavigationHelpers deployable = Deployable.find_by_name $1 url_for edit_catalog_deployable_path(deployable.catalogs.first, deployable) + when /^the (.*)'s provider priority groups page$/ + pool_provider_selection_provider_priority_groups_path(Pool.find_by_name($1)) + # Add more mappings here. # Here is an example that pulls values out of the Regexp: # diff --git a/src/spec/factories/provider_priority_group.rb b/src/spec/factories/provider_priority_group.rb new file mode 100644 index 0000000..43337da --- /dev/null +++ b/src/spec/factories/provider_priority_group.rb @@ -0,0 +1,25 @@ +# +# Copyright 2012 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +FactoryGirl.define do + + factory :provider_priority_group do + sequence(:name) { |n| "testprioritygroup-#{n}" } + score 10 + association :pool + end + +end -- 1.7.11.2
