Skip to content

Commit 76ff38d

Browse files
committed
Add a scenario for Viewing a portlet
1 parent b560298 commit 76ff38d

File tree

5 files changed

+41
-21
lines changed

5 files changed

+41
-21
lines changed

features/portlets.feature

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,14 @@ Feature: Portlets
1818
Then I should see the following content:
1919
| Login |
2020
| Password |
21-
| Remember me |
21+
| Remember me |
22+
23+
Scenario: Viewing a portlet
24+
Given I am logged in as a Content Editor
25+
And there is a "Portlet" with:
26+
| name | template |
27+
| A new portlet | Hello World |
28+
When I go to the content library
29+
And follow "Portlet"
30+
Then I should see the following content:
31+
| A new portlet |

features/step_definitions/data_steps.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
end
55
end
66

7+
8+
9+
710
# Creates a CMS::FileBlock
811
Given /^a text file named "([^"]*)" exists with:$/ do |file_name, text|
912
create_file(file_name, text)
@@ -23,6 +26,13 @@
2326
Factory(:html_block, table.hashes.first)
2427
end
2528

29+
# When there is a 'Portlet' with:
30+
# | name | content |
31+
# | A | B |
32+
When /^there is a "([^"]*)" with:$/ do |model_class, table|
33+
Factory(model_class.underscore.to_sym, table.hashes.first)
34+
end
35+
2636
When /^there is a page with:$/ do |table|
2737
Factory(:public_page, { :publish_on_save=>true }.merge(table.hashes.first))
2838
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Steps for portlet.features

features/support/paths.rb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@ module NavigationHelpers
77
#
88
def path_to(page_name)
99
case page_name
10+
when /^the home\s?page$/
11+
'/'
12+
when /^the content library$/
13+
cms_content_library_path
14+
# Add more mappings here.
15+
# Here is an example that pulls values out of the Regexp:
16+
#
17+
# when /^(.*)'s profile page$/i
18+
# user_profile_path(User.find_by_login($1))
1019

11-
when /^the home\s?page$/
12-
'/'
13-
14-
# Add more mappings here.
15-
# Here is an example that pulls values out of the Regexp:
16-
#
17-
# when /^(.*)'s profile page$/i
18-
# user_profile_path(User.find_by_login($1))
19-
20-
else
21-
begin
22-
page_name =~ /^the (.*) page$/
23-
path_components = $1.split(/\s+/)
24-
self.send(path_components.push('path').join('_').to_sym)
25-
rescue NoMethodError, ArgumentError
26-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
27-
"Now, go and add a mapping in #{__FILE__}"
28-
end
20+
else
21+
begin
22+
page_name =~ /^the (.*) page$/
23+
path_components = $1.split(/\s+/)
24+
self.send(path_components.push('path').join('_').to_sym)
25+
rescue NoMethodError, ArgumentError
26+
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
27+
"Now, go and add a mapping in #{__FILE__}"
28+
end
2929
end
3030
end
3131
end

upgrading_to_3_1.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Finishing tests:
3636
2. Replace any broken functional tests with a cucumber test.
3737

3838
rake test:functionals
39-
test_select(Cms::ContentTypesControllerTest) [test/functional/cms/content_types_controller_test.rb:16]:
40-
39+
test/functional/cms/portlets_controller_test.rb:47:in `test_destroy']:
4140
Unit tests leave seed data in DB.
4241

0 commit comments

Comments
 (0)