From: Tomas Sedovic <tsedovic(a)redhat.com>
Some of the tests still depended on the old controllers. This hooks it all up
to the new stuff.
---
src/features/authentication.feature | 6 +-
src/features/deployable.feature | 1 -
src/features/hardware_profile.feature | 1 -
src/features/instance.feature | 3 +-
src/features/pool.feature | 3 +-
src/features/pool_family.feature | 1 -
src/features/provider.feature | 3 +-
src/features/provider_account.feature | 1 -
src/features/role.feature | 1 -
src/features/settings.feature | 9 ++--
src/features/step_definitions/template_steps.rb | 8 ++--
src/features/step_definitions/web_steps.rb | 4 --
src/features/support/paths.rb | 9 +--
src/features/template.feature | 53 ++++++++++----------
src/features/user.feature | 1 -
src/spec/controllers/builds_controller_spec.rb | 2 +-
.../controllers/cloud_accounts_controller_spec.rb | 8 ++--
.../hardware_profiles_controller_spec.rb | 2 +-
src/spec/controllers/instance_controller_spec.rb | 5 +-
src/spec/controllers/pools_controller_spec.rb | 23 +--------
src/spec/controllers/provider_controller_spec.rb | 10 ++--
src/spec/controllers/templates_controller_spec.rb | 4 +-
src/spec/controllers/users_controller_spec.rb | 17 ++-----
23 files changed, 64 insertions(+), 111 deletions(-)
diff --git a/src/features/authentication.feature b/src/features/authentication.feature
index 0aa39fd..9e41789 100644
--- a/src/features/authentication.feature
+++ b/src/features/authentication.feature
@@ -17,7 +17,7 @@ Feature: User authentication
| Last name | Tester |
| E-mail | testuser(a)example.com |
And I press "Save"
- Then I should be on the dashboard page
+ Then I should be on the root page
Scenario: Want to register new user but decide to cancel
Given I am on the homepage
@@ -55,7 +55,7 @@ Feature: User authentication
Then should see "Editing Account"
When I fill in "E-mail" with "changed(a)example.com"
And I press "Save"
- Then I should be on the dashboard page
+ Then I should be on the root page
And I should see "User updated!"
Scenario: log out
@@ -81,4 +81,4 @@ Feature: User authentication
And I am on the login page
When I login with incorrect credentials
Then I should see "Login failed"
- And I should be on the login error page
\ No newline at end of file
+ And I should be on the login error page
diff --git a/src/features/deployable.feature b/src/features/deployable.feature
index 17c5764..012a459 100644
--- a/src/features/deployable.feature
+++ b/src/features/deployable.feature
@@ -6,7 +6,6 @@ Feature: Manage Deployables
Background:
Given I am an authorised user
And I am logged in
- And I am using new UI
Scenario: List deployables
Given I am on the homepage
diff --git a/src/features/hardware_profile.feature
b/src/features/hardware_profile.feature
index d93f7ce..b727772 100644
--- a/src/features/hardware_profile.feature
+++ b/src/features/hardware_profile.feature
@@ -6,7 +6,6 @@ Feature: Manage Pools
Background:
Given I am an authorised user
And I am logged in
- And I am using new UI
Scenario: View front end hardware profiles
Given there are the following aggregator hardware profiles:
diff --git a/src/features/instance.feature b/src/features/instance.feature
index ad22025..583ee49 100644
--- a/src/features/instance.feature
+++ b/src/features/instance.feature
@@ -7,7 +7,6 @@ Feature: Mange Instances
Background:
Given I am an authorised user
And I am logged in
- And I am using new UI
Scenario: Download an Instance Key
Given a mock running instance exists
@@ -109,4 +108,4 @@ Feature: Mange Instances
And I press "Search"
Then I should not see "mock"
And I should see "test"
- And I should not see "other"
\ No newline at end of file
+ And I should not see "other"
diff --git a/src/features/pool.feature b/src/features/pool.feature
index b26e556..1eced2a 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -6,7 +6,6 @@ Feature: Manage Pools
Background:
Given I am an authorised user
And I am logged in
- And I am using new UI
Scenario: Create a new Pool
Given I am on the pools page
@@ -37,7 +36,7 @@ Feature: Manage Pools
Scenario: Enter invalid characters into Name field
Given I am an authorised user
- And I am on the new pool page
+ And I am on the new resources pool page
When I fill in "pool[name]" with "@%&*())_@!#!"
And I press "Save"
Then I should see "Name must only contain: numbers, letters, spaces, '_'
and '-'"
diff --git a/src/features/pool_family.feature b/src/features/pool_family.feature
index 64c5635..441e927 100644
--- a/src/features/pool_family.feature
+++ b/src/features/pool_family.feature
@@ -6,7 +6,6 @@ Feature: Pool Families
Background:
Given I am an authorised user
And I am logged in
- And I am using new UI
Scenario: List pool families
Given I am on the homepage
diff --git a/src/features/provider.feature b/src/features/provider.feature
index 08704dd..c2f6da5 100644
--- a/src/features/provider.feature
+++ b/src/features/provider.feature
@@ -6,7 +6,6 @@ Feature: Manage Providers
Background:
Given I am an authorised user
And I am logged in
- And I am using new UI
Scenario: List providers
Given I am on the homepage
@@ -94,4 +93,4 @@ Feature: Manage Providers
And I press "Search"
Then I should see "Mock"
And I should not see "Test"
- And I should not see "Other"
\ No newline at end of file
+ And I should not see "Other"
diff --git a/src/features/provider_account.feature
b/src/features/provider_account.feature
index 964aba2..7f645ee 100644
--- a/src/features/provider_account.feature
+++ b/src/features/provider_account.feature
@@ -6,7 +6,6 @@ Feature: Manage Provider Accounts
Background:
Given I am an authorised user
And I am logged in
- And I am using new UI
Scenario: List provider accounts
Given I am on the homepage
diff --git a/src/features/role.feature b/src/features/role.feature
index 727259a..dbfb22b 100644
--- a/src/features/role.feature
+++ b/src/features/role.feature
@@ -8,7 +8,6 @@ Feature: Manage Roles
And I am logged in
Given there's a list of roles
And a role "Captain" exists
- And I am using new UI
Scenario: Change the name
Given I am on the admin roles page
diff --git a/src/features/settings.feature b/src/features/settings.feature
index c106ea8..3da9589 100644
--- a/src/features/settings.feature
+++ b/src/features/settings.feature
@@ -6,11 +6,10 @@ Feature: Manage System wide Settings
Background:
Given I am an authorised user
And I am logged in
- And I am using new UI
Scenario: Change the self service default quota
Given the default quota is set to 5
- And I am on the self service settings page
+ And I am on the self service admin settings page
When I fill in "self_service_default_quota[maximum_running_instances]" with
"8"
And I press "Save"
Then I should see "Settings Updated!"
@@ -19,7 +18,7 @@ Feature: Manage System wide Settings
Scenario: Invalid decimal entry for the self service default quota
Given the default quota is set to 5
- And I am on the self service settings page
+ And I am on the self service admin settings page
When I fill in "self_service_default_quota[maximum_running_instances]" with
"1.5"
And I press "Save"
Then I should see "Could not update the default quota"
@@ -28,7 +27,7 @@ Feature: Manage System wide Settings
Scenario: Invalid chars entry for the self service default quota
Given the default quota is set to 5
- And I am on the self service settings page
+ And I am on the self service admin settings page
When I fill in "self_service_default_quota[maximum_running_instances]" with
"abc"
And I press "Save"
Then I should see "Could not update the default quota"
@@ -37,7 +36,7 @@ Feature: Manage System wide Settings
Scenario: Invalid special chars entry for the self service default quota
Given the default quota is set to 5
- And I am on the self service settings page
+ And I am on the self service admin settings page
When I fill in "self_service_default_quota[maximum_running_instances]" with
"^&(*_!"
And I press "Save"
Then I should see "Could not update the default quota"
diff --git a/src/features/step_definitions/template_steps.rb
b/src/features/step_definitions/template_steps.rb
index e0ab543..990b67b 100644
--- a/src/features/step_definitions/template_steps.rb
+++ b/src/features/step_definitions/template_steps.rb
@@ -82,14 +82,14 @@ Then /^I should see "([^"]*)" followed by
"([^"]*)"$/ do |arg1, arg2|
end
Given /^there is a "([^"]*)" build$/ do |arg1|
- template = Factory.build :template, :name => arg1
- template.save!
- image = Factory.build(:image, :template => template)
+ @template = Factory.build :template, :name => arg1
+ @template.save!
+ image = Factory.build(:image, :template => @template)
image.save!
end
When /^I choose this template$/ do
- choose("ids__#{(a)template.id}")
+ click_link((a)template.name)
end
Given /^there is ec2 cloud account$/ do
diff --git a/src/features/step_definitions/web_steps.rb
b/src/features/step_definitions/web_steps.rb
index 53e5987..e6d6808 100644
--- a/src/features/step_definitions/web_steps.rb
+++ b/src/features/step_definitions/web_steps.rb
@@ -12,10 +12,6 @@ require File.expand_path(File.join(File.dirname(__FILE__),
"..", "support", "pat
# Commonly used webrat steps
#
http://github.com/brynary/webrat
-Given /^I am using new UI$/ do
- cookies['layout'] = 'newui'
-end
-
Given /^(?:|I )am on (.+)$/ do |page_name|
visit path_to(page_name)
end
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index 4bc7ba4..d59e780 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -56,9 +56,6 @@ module NavigationHelpers
when /the pool realms page/
pool_realms_path
- when /the dashboard page/
- dashboard_path
-
when /the instances page/
resources_instances_path
@@ -69,10 +66,10 @@ module NavigationHelpers
hardware_profiles_pool_path
when /the permissions page/
- url_for :action => 'list', :controller => 'permissions',
:only_path => true
+ url_for list_permissions_path
when /the new permission page/
- url_for :action => 'new', :controller => 'permissions',
:only_path => true
+ url_for new_permission_path
when /the new template page/
url_for new_template_path
@@ -81,7 +78,7 @@ module NavigationHelpers
url_for new_build_path
when /the template builds page/
- url_for builds_path
+ url_for image_factory_template_path(@template, :details_tab =>
'images')
when /the templates page/
templates_path
diff --git a/src/features/template.feature b/src/features/template.feature
index b7d75a8..b982dfe 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -7,23 +7,22 @@ Feature: Manage Templates
Given I am an authorised user
And I am logged in
And There is a mock pulp repository
- And I am using new UI
Scenario: Create a new Template
- Given I am on the templates page
- When I press "Template"
- Then I should be on the new template page
+ Given I am on the image factory templates page
+ When I follow "Create"
+ Then I should be on the new image factory template page
When I fill in the following:
| tpl_name | mocktemplate |
| tpl_platform | fedora |
| tpl_summary | mockdesc |
When I press "Save"
- Then I should be on the templates page
+ Then I should be on the image factory templates page
And I should see "Template saved"
And I should see "mocktemplate"
Scenario: Add a searched package to a new template
- Given I am on the new template page
+ Given I am on the new image factory template page
When I press "Add Software"
And I fill in "package_search" with "libdeltacloud"
And I press "package_search_button"
@@ -34,9 +33,9 @@ Feature: Manage Templates
And I should see "libdeltacloud"
Scenario: Add group and remove package to/from the template
- Given I am on the templates page
- When I press "Template"
- Then I should be on the new template page
+ Given I am on the image factory templates page
+ When I follow "Create"
+ Then I should be on the new image factory template page
When I fill in the following:
| tpl_name | mocktemplate |
And I press "Add Software"
@@ -51,17 +50,17 @@ Feature: Manage Templates
Then I should see "Managed Content to Bundle"
And the page should not contain "#package_libdeltacloud" selector
When I press "Save"
- Then I should be on the templates page
+ Then I should be on the image factory templates page
And I should see "Template saved"
And I should see "mocktemplate"
Scenario: Sorting templates
Given there is a "mock1" template
And there is a "mock2" template
- And I am on the templates page
- When I follow "Name" within ".templates"
+ And I am on the image factory templates page
+ When I follow "Name" within "#templates_table"
Then I should see "mock1" followed by "mock2"
- When I follow "Name" within ".templates"
+ When I follow "Name" within "#templates_table"
Then I should see "mock2" followed by "mock1"
Scenario: Sorting template builds
@@ -74,14 +73,14 @@ Feature: Manage Templates
Then I should see "mock2" followed by "mock1"
Scenario: Search software with empty string
- Given I am on the new template page
+ Given I am on the new image factory template page
When I press "Add Software"
And I fill in "package_search" with ""
And I press "package_search_button"
Then I should see "Search string is empty"
Scenario: Show software selection
- Given I am on the new template page
+ Given I am on the new image factory template page
And I press "Add Software"
Then I should see an input "Collections"
# test that we see a metagroup
@@ -92,37 +91,37 @@ Feature: Manage Templates
Scenario: Build template
Given there is a "mock1" template
And there is ec2 cloud account
- And I am on the templates page
+ And I am on the image factory templates page
When I choose this template
- And I press "Build"
- Then I should be on the new template build page
+ And I follow "Build"
+ Then I should be on the new image factory build page
And I should see "Build Request"
When I check "ec2"
And I press "Submit to Build"
- Then I should be on the template builds page
+ Then I should be on the image factory template page
And I should see "mock1"
Scenario: Build template which is already built
Given there is a "mock1" template
And there is ec2 cloud account
- And I am on the templates page
+ And I am on the image factory templates page
And there is ec2 build for this template
When I choose this template
- And I press "Build"
- Then I should be on the new template build page
+ And I follow "Build"
+ Then I should be on the new image factory build page
And I should see "Build Request"
When I check "ec2"
And I press "Submit to Build"
- Then I should be on the template builds page
+ Then I should be on the image factory template page
And I should see "mock1"
And I should see "An attempted build of this template for the target
'ec2' already exists"
Scenario: Build imported template
Given there is an imported template
- And I am on the templates page
+ And I am on the image factory templates page
When I choose this template
- And I press "Build"
- Then I should be on the templates page
+ And I follow "Build"
+ Then I should be on the image factory templates page
And I should see "Build imported template is not supported"
Scenario: Search for templates
@@ -166,4 +165,4 @@ Feature: Manage Templates
And I press "Search"
Then I should not see "Test1"
And I should see "Other"
- And I should not see "Mock"
\ No newline at end of file
+ And I should not see "Mock"
diff --git a/src/features/user.feature b/src/features/user.feature
index 1819cb5..34559c7 100644
--- a/src/features/user.feature
+++ b/src/features/user.feature
@@ -7,7 +7,6 @@ Feature: Manage Users
Given I am an authorised user
And I am logged in
And a user "testuser" exists
- And I am using new UI
Scenario: Change the password
Given I am on the admin users page
diff --git a/src/spec/controllers/builds_controller_spec.rb
b/src/spec/controllers/builds_controller_spec.rb
index ef4f3d4..31b47f5 100644
--- a/src/spec/controllers/builds_controller_spec.rb
+++ b/src/spec/controllers/builds_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe BuildsController do
+describe ImageFactory::BuildsController do
fixtures :all
before(:each) do
@admin_permission = Factory :admin_permission
diff --git a/src/spec/controllers/cloud_accounts_controller_spec.rb
b/src/spec/controllers/cloud_accounts_controller_spec.rb
index d61ad34..7f10af0 100644
--- a/src/spec/controllers/cloud_accounts_controller_spec.rb
+++ b/src/spec/controllers/cloud_accounts_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe CloudAccountsController do
+describe Admin::ProviderAccountsController do
fixtures :all
before(:each) do
@@ -53,16 +53,16 @@ describe CloudAccountsController do
@cloud_account.save.should be_true
post :update, :id => @cloud_account.id, :cloud_account => { :password =>
'mockpassword' }
- response.should redirect_to provider_accounts_path(@provider)
+ response.should redirect_to admin_provider_account_path(@provider)
CloudAccount.find((a)cloud_account.id).password.should == "mockpassword"
end
it "should allow users with account modify permission to delete a cloud
account" do
UserSession.create(@admin)
lambda do
- get :destroy, :id => @cloud_account.id
+ post :multi_destroy, :accounts_selected => [@cloud_account.id]
end.should change(CloudAccount, :count).by(-1)
- response.should redirect_to provider_accounts_path(@provider)
+ response.should redirect_to admin_provider_accounts_url
CloudAccount.find_by_id((a)cloud_account.id).should be_nil
end
diff --git a/src/spec/controllers/hardware_profiles_controller_spec.rb
b/src/spec/controllers/hardware_profiles_controller_spec.rb
index 5d21841..f9410dc 100644
--- a/src/spec/controllers/hardware_profiles_controller_spec.rb
+++ b/src/spec/controllers/hardware_profiles_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe HardwareProfilesController do
+describe Admin::HardwareProfilesController do
fixtures :all
before(:each) do
diff --git a/src/spec/controllers/instance_controller_spec.rb
b/src/spec/controllers/instance_controller_spec.rb
index 34a44c8..1c1552f 100644
--- a/src/spec/controllers/instance_controller_spec.rb
+++ b/src/spec/controllers/instance_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe InstancesController do
+describe Resources::InstancesController do
fixtures :all
before(:each) do
@admin_permission = Factory :admin_permission
@@ -11,8 +11,7 @@ describe InstancesController do
it "should provide ui to create new instance" do
UserSession.create(@admin)
get :new
- response.should be_success
- response.should render_template("new")
+ response.should redirect_to(select_template_resources_instances_path)
end
it "should fail to grant access to new pool ui for unauthenticated user" do
diff --git a/src/spec/controllers/pools_controller_spec.rb
b/src/spec/controllers/pools_controller_spec.rb
index c9fcc82..bc3488d 100644
--- a/src/spec/controllers/pools_controller_spec.rb
+++ b/src/spec/controllers/pools_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe PoolsController do
+describe Resources::PoolsController do
fixtures :all
before(:each) do
@admin_permission = Factory :admin_permission
@@ -26,27 +26,8 @@ describe PoolsController do
post :create, :pool => { :name => 'foopool' }
end.should change(Pool, :count).by(1)
id = Pool.find(:first, :conditions => ['name = ?',
'foopool']).id
- response.should redirect_to("http://test.host/pools/#{id}")
+ response.should redirect_to(resources_pool_path(id))
end
- it "should provide ui to view hardware profiles" do
- UserSession.create(@admin)
- pool = Factory :tpool
-
- get :hardware_profiles, :id => pool.id
- response.should be_success
- assigns[:hardware_profiles].size.should == pool.hardware_profiles.size
- response.should render_template("hardware_profiles")
- end
-
- it "should provide ui to view realms" do
- UserSession.create(@admin)
- pool = Factory :tpool
-
- get :realms, :id => pool.id
- response.should be_success
- assigns[:realm_names].size.should == pool.realms.size
- response.should render_template("realms")
- end
end
diff --git a/src/spec/controllers/provider_controller_spec.rb
b/src/spec/controllers/provider_controller_spec.rb
index 49a45a8..0b4661d 100644
--- a/src/spec/controllers/provider_controller_spec.rb
+++ b/src/spec/controllers/provider_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe ProvidersController do
+describe Admin::ProvidersController do
fixtures :all
before(:each) do
@@ -14,20 +14,20 @@ describe ProvidersController do
UserSession.create(@admin)
provider = @admin_permission.permission_object
- get :hardware_profiles, :id => provider.id
+ get :show, :id => provider.id, :details_tab => 'hw_profiles'
response.should be_success
assigns[:hardware_profiles].size.should == provider.hardware_profiles.size
- response.should render_template("hardware_profiles")
+ response.should render_template("admin/providers/_hw_profiles")
end
it "should provide ui to view realms" do
UserSession.create(@admin)
provider = @admin_permission.permission_object
- get :realms, :id => provider.id
+ get :show, :id => provider.id, :details_tab => 'realms'
response.should be_success
assigns[:realm_names].size.should == provider.realms.size
- response.should render_template("realms")
+ response.should render_template("admin/providers/_realms")
end
diff --git a/src/spec/controllers/templates_controller_spec.rb
b/src/spec/controllers/templates_controller_spec.rb
index 0ead1b0..65bb26c 100644
--- a/src/spec/controllers/templates_controller_spec.rb
+++ b/src/spec/controllers/templates_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe TemplatesController do
+describe ImageFactory::TemplatesController do
fixtures :all
before(:each) do
@@ -15,7 +15,7 @@ describe TemplatesController do
lambda do
post :create, :tpl => { :name => 'template', :platform =>
'fedora' }
end.should change(Template, :count).by(1)
- response.should redirect_to(templates_path)
+ response.should redirect_to(image_factory_templates_path)
end
it "should deny access to new template ui without image modify permission"
do
diff --git a/src/spec/controllers/users_controller_spec.rb
b/src/spec/controllers/users_controller_spec.rb
index f9a3dde..90b161b 100644
--- a/src/spec/controllers/users_controller_spec.rb
+++ b/src/spec/controllers/users_controller_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-describe UsersController do
+describe Admin::UsersController do
before(:each) do
@tuser = Factory :tuser
@@ -24,7 +24,7 @@ describe UsersController do
:password_confirmation => "testpass" }
end.should change(User, :count).by(1)
- response.should redirect_to(dashboard_url)
+ response.should redirect_to(root_path)
end
it "fails to create pool" do
@@ -53,7 +53,7 @@ describe UsersController do
:password_confirmation => "testpass" }
end.should change(User, :count)
- response.should redirect_to(users_url)
+ response.should redirect_to(admin_users_url)
end
it "should not allow a regular user to create user" do
@@ -84,16 +84,7 @@ describe UsersController do
UserSession.create(@tuser)
put :update, :id => @tuser.id, :user => {}, :commit => 'Save'
- response.should redirect_to(dashboard_path)
+ response.should redirect_to(root_path)
end
- # checks whether proper error template is rendered when an exception raises
- # "layouts/error" template should be displayed for all non-ajax error
- # responses, "layouts/popup-error" should be displayed for ajax
- # (see "Fixed error handling" patch for details)
- it "should render error template when getting nonexisting user" do
- UserSession.create(@tuser)
- get :show, :id => "unknown_id"
- response.should render_template("layouts/error")
- end
end
--
1.7.3.5