spec/cli_spec.rb in socialcast-1.2.1.RC1 vs spec/cli_spec.rb in socialcast-1.2.2
- old
+ new
@@ -5,12 +5,11 @@
# Expects -u=emily@socialcast.com -p=demo --domain=demo.socialcast.com
context 'with a basic message' do
before do
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
stub_request(:post, "https://ryan%40socialcast.com:foo@test.staging.socialcast.com/api/messages.json").
- with(:body => /message\_type\"\:null/).
- with(:body => /testing/).
+ with(:body => { "message" => { "body" => "testing", "url" => nil, "message_type" => nil, "attachment_ids" => [], "group_id" => nil }}).
with(:headers => {'Accept' => 'application/json'}).
to_return(:status => 200, :body => "", :headers => {})
Socialcast::CLI.start ['share', 'testing']
end
@@ -173,17 +172,19 @@
Net::LDAP.any_instance.stub(:search).and_yield(@entry)
@result = ''
Zlib::GzipWriter.stub(:open).and_yield(@result)
Socialcast.stub(:credentials).and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'credentials.yml')))
- Socialcast::CLI.any_instance.should_receive(:load_configuration).with('/my/path/to/ldap.yml').and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_without_permission_mappings.yml')))
+ Socialcast::CLI.any_instance.should_receive(:load_configuration).with('/my/path/to/ldap.yml').and_return(YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'ldap_with_plugin_mapping.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)
RestClient::Resource.any_instance.stub(:post)
Socialcast::CLI.start ['provision', '-c', '/my/path/to/ldap.yml', '--plugins', [File.join(File.dirname(__FILE__), 'fixtures', 'fake_attribute_map')]]
end
- it 'successfully processes' do end # see expectations
+ it 'successfully processes' do
+ @result.should =~ %r{rybn@exbmple.com}
+ 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'