root/websites/toror/trunk/vendor/plugins/twitter4r/spec/twitter/ext/stdlib_spec.rb @ 8678

Revision 8678, 1.2 kB (checked in by niku, 7 years ago)

toror

Line 
1require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
2
3describe Hash, "#to_http_str" do
4  before(:each) do
5    @http_params = {:id => 'otherlogin', :since_id => 3953743, :full_name => 'Lucy Cross'}
6    @id_regexp = Regexp.new("id=#{URI.encode(@http_params[:id].to_s)}")
7    @since_id_regexp = Regexp.new("since_id=#{URI.encode(@http_params[:since_id].to_s)}")
8    @full_name_regexp = Regexp.new("full_name=#{URI.encode(@http_params[:full_name].to_s)}")
9  end
10 
11  it "should generate expected URL encoded string" do
12    http_str = @http_params.to_http_str
13    http_str.should match(@id_regexp)
14    http_str.should match(@since_id_regexp)
15    http_str.should match(@full_name_regexp)
16  end
17 
18  after(:each) do
19    @http_params = nil
20    @id_kv_str, @since_id_kv_str, @full_name_kv_str = nil
21  end
22end
23
24describe Time, "#to_s" do
25  before(:each) do
26    @time = Time.now
27    @expected_string = @time.rfc2822
28  end
29 
30  it "should output RFC2822 compliant string" do
31    time_string = @time.to_s
32    time_string.should eql(@expected_string)
33  end
34 
35  it "should respond to #old_to_s" do
36    @time.should respond_to(:old_to_s)
37  end
38 
39  after(:each) do
40    nilize(@time, @expected_string)
41  end
42end
Note: See TracBrowser for help on using the browser.