Sha256: a8fe7c555c1edd274b173b08fb45dfddf57df54a1bf6abca65469da6bc9dfb26

Contents?: true

Size: 1.34 KB

Versions: 109

Compression:

Stored size: 1.34 KB

Contents

require 'helper'

describe Bearcat::Client::GroupMemberships do
  before do
    @client = Bearcat::Client.new(prefix: "http://canvas.instructure.com", token: "test_token")
  end

  it "creates a group membership" do
    stub_post(@client, "/api/v1/groups/3/memberships").with(:body => {"user_id"=>"6"}).to_return(json_response("created_group_membership.json"))
    created_group_membership = @client.create_group_membership(3, { user_id: 6 })
    created_group_membership['id'] == 14
    created_group_membership['group_id'] == 3
    created_group_membership['workflow_state'] == 'accepted'
    created_group_membership['user_id'] == 6
  end

  describe 'GroupMemberships#delete_group_membership' do

    context 'deleting the group membership by id' do
      it 'deletes a group membership' do
        stub_delete(@client, "/api/v1/groups/3/memberships/3").to_return(json_response("ok.json"))
        deleted_response = @client.delete_group_membership(3, 'memberships', 3)
        deleted_response['ok'] == true
      end
    end

    context 'deleting the group membership by user and group id' do
      it 'deletes a group membership' do
        stub_delete(@client, "/api/v1/groups/3/users/3").to_return(json_response("ok.json"))
        deleted_response = @client.delete_group_membership(3, 'users', 3)
        deleted_response['ok'] == true
      end
    end
  end
end

Version data entries

109 entries across 109 versions & 1 rubygems

Version Path
bearcat-1.3.44 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.43 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.41 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.40 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.39 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.38 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.37 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.36 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.35 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.34 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.33 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.32 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.30 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.28 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.27 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.26 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.25 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.24 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.23 spec/bearcat/group_memberships_spec.rb
bearcat-1.3.22 spec/bearcat/group_memberships_spec.rb