spec/integration_spec_helper.rb in rmega-0.2.0 vs spec/integration_spec_helper.rb in rmega-0.2.1
- old
+ new
@@ -1,17 +1,23 @@
require 'spec_helper'
def account_file_path
- File.join File.dirname(__FILE__), 'integration/rmega_account.yml'
+ File.join(File.dirname(__FILE__), "account.yaml")
end
-def account_file_exists?
- File.exists? account_file_path
+def account?
+ account
end
def account
- @account ||= YAML.load_file account_file_path
+ if ENV["MEGA_EMAIL"] and ENV["MEGA_PASSWORD"]
+ {'email' => ENV["MEGA_EMAIL"], 'password' => ENV["MEGA_PASSWORD"]}
+ elsif File.exists?(account_file_path)
+ YAML.load_file(account_file_path)
+ else
+ nil
+ end
end
def login
Rmega.login(account['email'], account['password'])
end
@@ -20,10 +26,9 @@
Dir.tmpdir
end
RSpec.configure do |config|
config.before(:all) do
- Rmega.options.show_progress = false
FileUtils.mkdir_p(temp_folder)
end
config.after(:all) do
FileUtils.rm_rf(temp_folder)