From: Jan Provaznik <[email protected]>

---
 src/features/step_definitions/template_steps.rb |   13 ++++++++++
 src/features/support/custom.rb                  |    4 +++
 src/features/support/paths.rb                   |    3 ++
 src/features/template.feature                   |   28 +++++++++++++++++++++++
 4 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/src/features/step_definitions/template_steps.rb 
b/src/features/step_definitions/template_steps.rb
index 894bf0a..9d82f3a 100644
--- a/src/features/step_definitions/template_steps.rb
+++ b/src/features/step_definitions/template_steps.rb
@@ -75,3 +75,16 @@ Given /^there is a "([^"]*)" build$/ do |arg1|
   image = Factory.build(:image, :template => template)
   image.save!
 end
+
+When /^I choose this template$/ do
+  choose("[email protected]}")
+end
+
+Given /^there is ec2 cloud account$/ do
+  account = Factory.build(:ec2_cloud_account)
+  account.save!
+end
+
+Given /^there is ec2 build for this template$/ do
+  Image.build(@template, 'ec2')
+end
diff --git a/src/features/support/custom.rb b/src/features/support/custom.rb
index b5440ae..0054a43 100644
--- a/src/features/support/custom.rb
+++ b/src/features/support/custom.rb
@@ -31,6 +31,10 @@ CloudAccount.class_eval do
   
   alias :generate_cloud_account_key_original :generate_cloud_account_key 
 
+  def validate_credentials
+    true
+  end
+
   def generate_cloud_account_key
   end
 
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index 1c73ffa..d55f1f3 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 new_template_path
 
+    when /the new template build page/
+      url_for new_build_path
+
     when /the template builds page/
       url_for builds_path
 
diff --git a/src/features/template.feature b/src/features/template.feature
index 4ce0151..e4cf867 100644
--- a/src/features/template.feature
+++ b/src/features/template.feature
@@ -87,3 +87,31 @@ Feature: Manage Templates
     Then I should see an input "admin-tools"
     # test that we see a collection (collections are loaded by default)
     And I should see an input "deltacloud"
+
+  Scenario: Build template
+    Given there is a "mock1" template
+    And there is ec2 cloud account
+    And I am on the templates page
+    When I choose this template
+    And I press "Build"
+    Then I should be on the new template 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
+    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 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 should see "Build Request"
+    When I check "ec2"
+    And I press "Submit to Build"
+    Then I should be on the template builds page
+    And I should see "mock1"
+    And I should see "An attempted build of this template for the target 'ec2' 
already exists"
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to