Sha256: 7cc12fd9e6377f7a1a84445e6cadd7ced145b5c583a145691b6b9fa1a9bf49c8

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe Yammer::Message do

  before :all do
    Yammer.configure do |conf|
      conf.access_token = 'TolNOFka9Uls2DxahNi78A'
    end
  end

  after :all do
    Yammer.reset!
  end

  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    => { :body => 'python not ruby', :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('python not ruby', :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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yammer-client-0.1.8 spec/model/message_spec.rb
yammer-client-0.1.7 spec/model/message_spec.rb
yammer-client-0.1.6 spec/model/message_spec.rb
yammer-client-0.1.5 spec/model/message_spec.rb