Skip to content

Commit 3b5d2c5

Browse files
committed
Alberich integration: fix cucumber tests
1 parent 4f11aba commit 3b5d2c5

File tree

5 files changed

+32
-31
lines changed

5 files changed

+32
-31
lines changed

src/features/permission.feature

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Feature: Manage Permissions
1515
And there is not a permission for the user "testuser"
1616
When I follow "Grant Access"
1717
Then I should be on the new permission page
18-
And I should see "Choose roles for users"
18+
And I should see "Choose roles for"
1919
When I select "Pool User" role for the user "testuser"
2020
And I press "Grant Access"
2121
Then I should be on the page for the pool "PermissionPool"
22-
And I should see "Added the following User Roles"
22+
And I should see "Added the following permission grants"
2323
And I should see "testuser"
2424

2525
Scenario: Create a second permission on a resource
@@ -28,11 +28,11 @@ Feature: Manage Permissions
2828
When I follow link with ID "details_permissions"
2929
When I follow "Grant Access"
3030
Then I should be on the new permission page
31-
And I should see "Choose roles for users"
31+
And I should see "Choose roles for Pool"
3232
When I select "Pool Admin" role for the user "testuser"
3333
And I press "Grant Access"
3434
Then I should be on the page for the pool "PermissionPool"
35-
And I should see "Added the following User Roles"
35+
And I should see "Added the following permission grants"
3636
And I should see "testuser"
3737

3838
Scenario: Attempt to duplicate a permission
@@ -41,11 +41,11 @@ Feature: Manage Permissions
4141
When I follow link with ID "details_permissions"
4242
When I follow "Grant Access"
4343
Then I should be on the new permission page
44-
And I should see "Choose roles for users"
44+
And I should see "Choose roles for Pool"
4545
When I select "Pool User" role for the user "testuser"
4646
And I press "Grant Access"
4747
Then I should be on the page for the pool "PermissionPool"
48-
And I should see "Could not add these User Roles"
48+
And I should see "Could not add the following permission grants"
4949
And I should see "testuser"
5050

5151
Scenario: Delete a permission
@@ -65,5 +65,5 @@ Feature: Manage Permissions
6565
When I follow "PermPool"
6666
When I follow link with ID "details_permissions"
6767
When I follow "Inherited Access"
68-
Then I should see "Inherited From"
68+
Then I should see "Inherited from"
6969
And I should see "PermFamily"

src/features/role.feature

+4-6
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Feature: Manage Roles
1414
And there should be a role named "Captain"
1515
When I follow "Captain"
1616
And I follow "Edit"
17-
Then I should see "Editing Role:"
17+
Then I should see "Editing role"
1818
When I fill in "role[name]" with "Admiral"
19-
And I press "Save"
19+
And I press "Update Alberich/role"
2020
Then I should see "Role updated successfully"
2121

2222
Scenario: Show role details
@@ -29,12 +29,10 @@ Feature: Manage Roles
2929
Given a role "Admiral" exists
3030
And I am on the roles page
3131
And there are 2 more roles
32-
When I check "Admiral" role
33-
And I check "Captain" role
34-
And I press "Delete"
32+
When I delete the role "Admiral"
33+
When I delete the role "Captain"
3534
Then there should be 0 more roles
3635
And I should be on the roles page
37-
And I should see "These Roles were deleted: Captain, Admiral"
3836

3937
# Scenario: Search roles
4038
# Given a role "Admiral" exists

src/features/step_definitions/permission_steps.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
end
1919

2020
Given /^there is not a permission for the user "([^\"]*)"$/ do |username|
21-
Permission.first(:include => ['entity' => ['session_entities' => 'user']], :conditions => ['users.username = ?', username]).should be_nil
21+
Alberich::Permission.first(:include => ['entity' => ['session_entities' => 'user']], :conditions => ['users.username = ?', username]).should be_nil
2222
end
2323

2424
Given /^there is a permission for the user "([^\"]*)"$/ do |username|

src/features/step_definitions/role_steps.rb

+14-14
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,47 @@
1414
# limitations under the License.
1515
#
1616
Given /there's no role/ do
17-
Role.destroy_all
17+
Alberich::Role.destroy_all
1818
end
1919

2020
Given /there's a list of roles/ do
21-
@initial_num_roles = Role.count
21+
@initial_num_roles = Alberich::Role.count
2222
end
2323

2424
Given /^a role "([^"]*)" exists$/ do |role_name|
25-
Role.create(:name => role_name, :scope => BasePermissionObject.to_s)
25+
Alberich::Role.create(:name => role_name, :scope => Alberich::BasePermissionObject.to_s)
2626
end
2727

2828
Given /^there should be a role named "([^\"]*)"$/ do |name|
29-
Role.find_by_name(name).should_not == nil
29+
Alberich::Role.find_by_name(name).should_not == nil
3030
end
3131

3232
Given /^there are (\d+) roles$/ do |number|
33-
Role.count.should == number.to_i
33+
Alberich::Role.count.should == number.to_i
3434
end
3535

3636
Given /^there are (\d+) more roles$/ do |number|
37-
Role.count.should == @initial_num_roles + number.to_i
37+
Alberich::Role.count.should == @initial_num_roles + number.to_i
3838
end
3939

4040
Given /^there are (\d+) fewer roles$/ do |number|
41-
Role.count.should == @initial_num_roles - number.to_i
42-
(@initial_num_roles + Role.count).should == number.to_i
41+
Alberich::Role.count.should == @initial_num_roles - number.to_i
42+
(@initial_num_roles + Alberich::Role.count).should == number.to_i
4343
end
4444

45-
When /^(?:|I )check "([^"]*)" role$/ do |role_name|
46-
role = Role.find_by_name(role_name)
47-
check("role_checkbox_#{role.id}")
45+
When /^I delete the role "(.*?)"$/ do |role_name|
46+
role = Alberich::Role.find_by_name(role_name)
47+
click_link("destroy_role_#{role.id}")
4848
end
4949

5050
Then /^there should only be (\d+) roles$/ do |number|
51-
Role.count.should == number.to_i
51+
Alberich::Role.count.should == number.to_i
5252
end
5353

5454
Then /^there should be (\d+) more roles$/ do |number|
55-
Role.count.should == @initial_num_roles + number.to_i
55+
Alberich::Role.count.should == @initial_num_roles + number.to_i
5656
end
5757

5858
Then /^there should be (\d+) fewer roles$/ do |number|
59-
Role.count.should == (@initial_num_roles - number.to_i)
59+
Alberich::Role.count.should == (@initial_num_roles - number.to_i)
6060
end

src/features/support/paths.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def path_to(page_name)
4242
user_group_path(UserGroup.find_by_name($1))
4343

4444
when /^(.*)'s role page$/i
45-
role_path(Role.find_by_name($1))
45+
alberich.role_path(Alberich::Role.find_by_name($1))
4646

4747
when /^(.*)'s frontend realm page$/i
4848
frontend_realm_path(FrontendRealm.find_by_name($1))
@@ -125,10 +125,13 @@ def path_to(page_name)
125125
hardware_profiles_pool_path
126126

127127
when /the permissions page/
128-
url_for list_permissions_path
128+
url_for alberich.list_permissions_path
129129

130130
when /the new permission page/
131-
url_for new_permission_path
131+
url_for alberich.new_permission_path
132+
133+
when /the roles page/
134+
url_for alberich.roles_path
132135

133136
when /the pool family provider accounts page/
134137
url_for pool_family_path(@pool_family, :details_tab => 'provider_accounts')

0 commit comments

Comments
 (0)