Sha256: af2ac641a0806b63faa93200640554dae4eeeffcfe43aad162dfda3b071300b1

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

require 'test_helper'

class TestGroup < MiniTest::Unit::TestCase
  def setup
    @coop = Coop.new("test@example.com", "password")
    @group = @coop.group(12345)
  end
  
  def test_new_object
    assert_instance_of Coop::Group, Coop::Group.new
  end
  
  def test_session_proxy
    assert_instance_of Coop::Group, @group
  end
  
  def test_statuses
    assert_instance_of Coop::Status, @group.statuses
  end
  
  def test_set_group_id_on_status
    assert_equal @group.statuses.group_id, @group.id
  end
  
  def test_post
    stub_post("/groups/#{@group.id}/statuses").with({
      headers: { 'Accept' => 'application/xml' },
      query: { status: "Testing update" }
    }).to_return({ 
      headers: { 'Location' => '/statuses/123456' } 
    })
    
    assert_equal "/statuses/123456", @group.post!("Testing update")
  end
  
  def test_post_as_cobot
    stub_post("/groups/12345/statuses").with({
      headers: { 'Accept' => 'application/xml' },
      query: { key: "BeepBoopAPIKeyGoesHere", status: "Testing update as Cobot" }
    }).to_return({ 
      headers: { 'Location' => '/statuses/123456' } 
    })
    
    assert_equal "/statuses/123456", @group.post_as_cobot!("Testing update as Cobot", "BeepBoopAPIKeyGoesHere")
  end
  
  def test_agenda
    assert_instance_of Coop::Agenda, @group.agenda
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
coop-1.0.1 test/coop/api_object/test_group.rb
coop-1.0.0 test/coop/api_object/test_group.rb