Sha256: fc54a95f18c89627cd49428a0664d50376b59f56af8b3f451a41805216248e85

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

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

describe Yammer::Group do
  context 'class methods' do

    subject { Yammer::Group }

    describe '#create' do
      it 'creates a new group' do
        stub_request(:post, "https://www.yammer.com/api/v1/groups").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/groups/2'}
        )
        subject.create(:name => 'rails team', :privacy => 'public')
      end
    end

    describe '#get' do
      it 'returns group response' do
        stub_request(:get, "https://www.yammer.com/api/v1/groups/1").with(
          :headers => {
            'Accept'          => 'application/json',
            'Authorization'   => "Bearer #{Yammer.access_token}",
            'User-Agent'      => "Yammer Ruby Gem #{Yammer::Version}"
          }
        ).to_return(
          :status => 200,
          :body => fixture('group.json'),
          :headers => {}
        )
        subject.get(1)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yammer-client-0.1.2 spec/model/group_spec.rb
yammer-client-0.1.1 spec/model/group_spec.rb
yammer-client-0.1.0 spec/model/group_spec.rb