require File.dirname(__FILE__) + '/test_helper.rb' class TestRequest < Test::Unit::TestCase include Instapaper::Exceptions include Instapaper::Response include Instapaper::Request def setup @url = "http://en.wikipedia.org/wiki/Example.com" @title = "MyTitle" @selection = "MySelection" @auto_title = 0 @opts = {:title => @title,:selection => @selection,:auto_title => @auto_title} @instapaper_a = Instapaper::Base.new("instapaper-rubygem","instapaper-rubygem") end def test_add_url req = @instapaper_a.add(@url) assert_instance_of(AddURLSuccessResponse,req) assert_kind_of(AbstractRequest, req.request) data = req.request.post_data assert_nil(data["title"]) assert_nil(data["selection"]) assert_nil(data["auto-title"]) end def test_add_url_with_options req = @instapaper_a.add(@url,@opts) assert_instance_of(AddURLSuccessResponse,req) assert_kind_of(AbstractRequest, req.request) data = req.request.post_data assert_equal(@title,data["title"]) assert_equal(@selection,data["selection"]) assert_equal(@auto_title,data["auto-title"]) end end