spec/cli_spec.rb in socialcast-1.0.5 vs spec/cli_spec.rb in socialcast-1.0.6
- old
+ new
@@ -1,8 +1,27 @@
require 'spec_helper'
describe Socialcast::CLI do
describe '#provision' do
+ context 'with absolute path to ldap.yml file' do
+ before do
+ @entry = Net::LDAP::Entry.new("dc=example,dc=com")
+ @entry[:mail] = 'ryan@example.com'
+ Net::LDAP.any_instance.stub(:search).and_yield(@entry)
+
+ @result = ''
+ Zlib::GzipWriter.stub(:open).and_yield(@result)
+
+ File.should_receive(:open).with('/my/path/to/ldap.yml').and_yield(File.read(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_without_permission_mappings.yml')))
+ File.should_receive(:exists?).with('/my/path/to/ldap.yml').and_return(true)
+ File.stub(:open).with(/users.xml.gz/, anything).and_yield(@result)
+ File.stub(:open).with(/credentials.yml/).and_yield(File.read(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
+ RestClient::Resource.any_instance.stub(:post)
+
+ Socialcast::CLI.start ['provision', '-c', '/my/path/to/ldap.yml']
+ end
+ it 'resolves absolute path without using current process directory' do end # see expectations
+ end
context 'with ldap.yml configuration excluding permission_mappings' do
before do
@entry = Net::LDAP::Entry.new("dc=example,dc=com")
@entry[:mail] = 'ryan@example.com'