Skip to content
Browse files

cleanup spec-helper

  • Loading branch information...
1 parent fd380df commit e537cec3db9916dbabf1e0206c29c8afc9a82338 @phoet committed Jul 14, 2012
Showing with 38 additions and 36 deletions.
  1. +2 −36 spec/spec_helper.rb
  2. +36 −0 spec/support/helper.rb
View
38 spec/spec_helper.rb
@@ -1,6 +1,7 @@
require "pry"
require "vcr"
require "saaspose"
+require "support/helper"
# See https://github.com/myronmarston/vcr
VCR.configure do |c|
@@ -19,40 +20,5 @@
example.call
end
end
-end
-
-# Setting for CI
-ENV["SAASPOSE_APPSID"] ||= "appsid"
-ENV["SAASPOSE_APPKEY"] ||= "appkey"
-
-REMOTE_ROOT_DIR = ""
-
-PNG_PATH = "/tmp/test.png"
-PDF_PATH = "/tmp/test.pdf"
-
-TEST_PDF_NAME = "saaspose_test.pdf"
-TEST_PPT_NAME = "saaspose_test.ppt"
-TEST_DOC_NAME = "saaspose_test.doc"
-TEST_XLS_NAME = "saaspose_test.xls"
-
-
-def configure_client
- Saaspose::Configuration.configure do |config|
- config.app_sid = ENV["SAASPOSE_APPSID"]
- config.app_key = ENV["SAASPOSE_APPKEY"]
- config.logger = nil
- end
-end
-
-def ensure_remote_file(test_file)
- VCR.use_cassette("ensure_remote_file #{test_file}", :record => :new_episodes, :match_requests_on => [:host, :path]) do
- unless Saaspose::Storage.files.map(&:name).include?(test_file)
- puts "uploading #{test_file} for testing purposes"
- Saaspose::Storage.upload(fixture_path(test_file), REMOTE_ROOT_DIR)
- end
- end
-end
-
-def fixture_path(name)
- File.expand_path("fixtures/#{name}", File.dirname(__FILE__))
+ config.include Helper
end
View
36 spec/support/helper.rb
@@ -0,0 +1,36 @@
+# Setting for CI
+ENV["SAASPOSE_APPSID"] ||= "appsid"
+ENV["SAASPOSE_APPKEY"] ||= "appkey"
+
+REMOTE_ROOT_DIR = ""
+
+PNG_PATH = "/tmp/test.png"
+PDF_PATH = "/tmp/test.pdf"
+
+TEST_PDF_NAME = "saaspose_test.pdf"
+TEST_PPT_NAME = "saaspose_test.ppt"
+TEST_DOC_NAME = "saaspose_test.doc"
+TEST_XLS_NAME = "saaspose_test.xls"
+
+module Helper
+ def configure_client
+ Saaspose::Configuration.configure do |config|
+ config.app_sid = ENV["SAASPOSE_APPSID"]
+ config.app_key = ENV["SAASPOSE_APPKEY"]
+ config.logger = nil
+ end
+ end
+
+ def ensure_remote_file(test_file)
+ VCR.use_cassette("ensure_remote_file #{test_file}", :record => :new_episodes, :match_requests_on => [:host, :path]) do
+ unless Saaspose::Storage.files.map(&:name).include?(test_file)
+ puts "uploading #{test_file} for testing purposes"
+ Saaspose::Storage.upload(fixture_path(test_file), REMOTE_ROOT_DIR)
+ end
+ end
+ end
+
+ def fixture_path(name)
+ File.expand_path("../fixtures/#{name}", File.dirname(__FILE__))
+ end
+end

0 comments on commit e537cec

Please sign in to comment.
Something went wrong with that request. Please try again.