1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
require File.dirname(__FILE__) + '/../spec_helper'
describe AssetSync do
include_context "mock Rails"
describe 'using Rackspace with initializer' do
before(:each) do
set_rails_root('without_yml')
AssetSync.config = AssetSync::Config.new
AssetSync.configure do |config|
config.fog_provider = 'Rackspace'
config.fog_directory = 'mybucket'
config.fog_region = 'dunno'
config.rackspace_username = 'aaaa'
config.rackspace_api_key = 'bbbb'
config.existing_remote_files = 'keep'
end
end
it "should configure provider as Rackspace" do
expect(AssetSync.config.fog_provider).to eq('Rackspace')
expect(AssetSync.config).to be_rackspace
end
it "should keep existing remote files" do
expect(AssetSync.config.existing_remote_files?).to eq(true)
end
it "should configure rackspace_username" do
expect(AssetSync.config.rackspace_username).to eq("aaaa")
end
it "should configure rackspace_api_key" do
expect(AssetSync.config.rackspace_api_key).to eq("bbbb")
end
it "should configure fog_directory" do
expect(AssetSync.config.fog_directory).to eq("mybucket")
end
it "should configure fog_region" do
expect(AssetSync.config.fog_region).to eq("dunno")
end
it "should configure existing_remote_files" do
expect(AssetSync.config.existing_remote_files).to eq("keep")
end
it "should configure existing_remote_files" do
expect(AssetSync.config.existing_remote_files).to eq("keep")
end
it "should default rackspace_auth_url to false" do
expect(AssetSync.config.rackspace_auth_url).to be_falsey
end
end
describe 'using Rackspace from yml' do
before(:each) do
set_rails_root('rackspace_with_yml')
AssetSync.config = AssetSync::Config.new
end
it "should keep existing remote files" do
expect(AssetSync.config.existing_remote_files?).to eq(true)
end
it "should configure rackspace_username" do
expect(AssetSync.config.rackspace_username).to eq("xxxx")
end
it "should configure rackspace_api_key" do
expect(AssetSync.config.rackspace_api_key).to eq("zzzz")
end
it "should configure fog_directory" do
expect(AssetSync.config.fog_directory).to eq("rails_app_test")
end
it "should configure fog_region" do
expect(AssetSync.config.fog_region).to eq("eu-west-1")
end
it "should configure existing_remote_files" do
expect(AssetSync.config.existing_remote_files).to eq("keep")
end
end
end
|