On Monday 30 of May 2011 16:22:44 tsedovic(a)redhat.com wrote:
From: Tomas Sedovic <tsedovic(a)redhat.com>
Previously, both the RSpec and Cucumber tests for image
import failed when
the Image Warehouse service was not started.
This stubs the `upload` method when the tests are running.
---
src/features/image_import.feature | 1 +
.../step_definitions/image_import_steps.rb | 5 +++++
src/spec/models/image_spec.rb | 4 ++++
3 files changed, 10 insertions(+), 0 deletions(-)
create mode 100644
src/features/step_definitions/image_import_steps.rb
diff --git a/src/features/image_import.feature
b/src/features/image_import.feature index a5e9d58..1f85309
100644
--- a/src/features/image_import.feature
+++ b/src/features/image_import.feature
@@ -10,6 +10,7 @@ Feature: Import Images
And there is a provider named "testprovider"
And there is a provider account named "provider1"
And There is a mock pulp repository
+ And Image Warehouse is running
When I go to the new image import page
Then I should be on the new image import page
diff --git a/src/features/step_definitions/image_import_steps.rb
b/src/features/step_definitions/image_import_steps.rb new file
mode 100644
index 0000000..baf0cb1
--- /dev/null
+++ b/src/features/step_definitions/image_import_steps.rb
@@ -0,0 +1,5 @@
+Given /^Image Warehouse is running$/ do
+ # Stub the `upload` class method. This saves us from
requining
+ # Image Warehouse daemon to be running for the tests.
+ ImageWarehouseObject.send(:define_method, :upload) { nil
}
+end
diff --git a/src/spec/models/image_spec.rb
b/src/spec/models/image_spec.rb
index b902fe1..001b197 100644
--- a/src/spec/models/image_spec.rb
+++ b/src/spec/models/image_spec.rb
@@ -58,6 +58,10 @@ describe Image do
account.stub!(:valid_credentials?).and_return(true)
account.save!
+ # Stub the `upload` class method. This saves us from
requining
+ # Image Warehouse daemon to be running for the tests.
+ ImageWarehouseObject.send(:define_method, :upload) { nil
}
+
lambda do
lambda do
lambda do
Fixed failing tests for me. ACK