Sha256: 90eaaedf48950338b431cd50c0e0091532eb0446c203fe8081ebeb51f7660a19

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

require "webmock/test_unit"
require "test/unit"
require "shoulda"
require "./lib/rsift"

class CommentTest < Test::Unit::TestCase
  include WebMock::API

  def setup
    @api_url = YAML::load_file("config/keys.yml")["url"]
    @api_key = YAML::load_file("config/keys.yml")["api-key"]
    @username = YAML::load_file("config/keys.yml")["username"]
    @comment = Rsift::Comment.new(@api_url,@api_key,@username)
  end  

  context "with comments" do
    setup do
      body = '{"success":true}'
      stub_request(:get, /api.datasift.net\/comment/).
        with(:headers => {'Accept'=>'*/*'}).
        to_return(:status => 200, :body => body, :headers => {})
      
    end
    
    should "get a comment" do
      opts = {:stream_id => "1"}
      response = @comment.do("get",opts)
      assert_equal true, response["success"]
    end
    
    should "create a comment" do
      opts = {:stream_id => "1", :comment => "test comment"}
      response = @comment.do("create",opts)
      assert_equal true, response["success"]
    end
    
    should "flag a comment" do
      opts = {:comment_id => "1"}
      response = @comment.do("flag",opts)
      assert_equal true, response["success"]      
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rsift-0.3.6 test/unit/comment_test.rb
rsift-0.3.5 test/unit/comment_test.rb
rsift-0.3.4 test/unit/comment_test.rb
rsift-0.3.3 test/unit/comment_test.rb
rsift-0.3.2 test/unit/comment_test.rb