require File.expand_path('../../spec_helper', __FILE__) describe Yammer::Message do context 'class methods' do subject { Yammer::Message } describe '#create' do it 'creates a new group' do stub_request(:post, "https://www.yammer.com/api/v1/messages").with( :body => { :name => 'rails team', :privacy => 'public' }, :headers => { 'Accept' => 'application/json', 'Authorization' => "Bearer #{Yammer.access_token}", 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => "Yammer Ruby Gem #{Yammer::Version}" } ).to_return( :status => 201, :body => '', :headers => {'Location' => 'https://www.yammer.com/api/v1/messages/2'} ) subject.create(:name => 'rails team', :privacy => 'public') end end describe '#get' do it 'returns message response' do stub_request(:get, "https://www.yammer.com/api/v1/messages/1").with( :headers => { 'Accept' => 'application/json', 'Authorization' => "Bearer #{Yammer.access_token}", 'User-Agent' => "Yammer Ruby Gem #{Yammer::Version}" } ).to_return( :status => 200, :body => fixture('message.json'), :headers => {} ) subject.get(1) end end end end