From: Jan Provaznik <[email protected]>
---
src/features/step_definitions/template_steps.rb | 19 +++++++++++++++----
src/features/support/paths.rb | 3 +++
src/features/template.feature | 18 ++++++++++++++++++
3 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/src/features/step_definitions/template_steps.rb
b/src/features/step_definitions/template_steps.rb
index c793e01..9d3bd96 100644
--- a/src/features/step_definitions/template_steps.rb
+++ b/src/features/step_definitions/template_steps.rb
@@ -16,10 +16,10 @@ Given /^There is a mock pulp repository$/ do
end
-Given /^There is a "([^"]*)" template$/ do |name|
- @template = Template.new
+Given /^there is a "([^"]*)" template$/ do |name|
+ @template = Factory.build :template
@template.xml.name = name
- @template.save_xml!
+ @template.save!
end
Given /^there is a package group$/ do
@@ -41,7 +41,7 @@ end
# web_steps.rb and in this case I have to use @template as parameter which "I
# am" doesn't support
Given /^I jump on the "([^"]*)" template software page$/ do |name|
- visit url_for :action => 'software', :controller => 'templates', :id =>
@template
+ visit url_for(:action => 'software', :controller => 'templates', :id =>
@template)
end
Then /^I should have a template named "([^"]*)"$/ do |name|
@@ -64,3 +64,14 @@ end
Then /^the page should not contain "([^"]*)" selector$/ do |selector|
response.should_not have_selector(selector)
end
+
+Then /^I should see "([^"]*)" followed by "([^"]*)"$/ do |arg1, arg2|
+ # webrat doesn't support checking order of elements on a page, so
+ # this seems to be siplest check
+ response.body =~ /#{Regexp.escape(arg1)}.*#{Regexp.escape(arg1)}/
+end
+
+# FIXME: move this into image_steps when it exists
+Given /^there is a "([^"]*)" image$/ do |arg1|
+ @image = Factory.build :image
+end
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index fdc63f5..198099b 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -68,6 +68,9 @@ module NavigationHelpers
when /the new template page/
url_for :action => 'new', :controller => 'templates', :only_path => true
+ when /the template builds page/
+ url_for :action => 'builds', :controller => 'templates', :only_path =>
true
+
when /the templates page/
templates_path
diff --git a/src/features/template.feature b/src/features/template.feature
index 73de5ca..26776ac 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -42,3 +42,21 @@ Feature: Manage Templates
Then I should be on the 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"
+ Then I should see "mock1" followed by "mock2"
+ When I follow "Name" within ".templates"
+ Then I should see "mock2" followed by "mock1"
+
+ Scenario: Sorting template builds
+ Given there is a "mock1" image
+ And there is a "mock2" image
+ And I am on the template builds page
+ When I follow "Name"
+ Then I should see "mock1" followed by "mock2"
+ When I follow "Name"
+ Then I should see "mock2" followed by "mock1"
--
1.7.2.3
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel