Sha256: 827d7fdf4deb24c2d3a0b553f3fa86f94a2b0e18aa05a060bce9c7574ec7abb0

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')

describe Hash, "#to_http_str" do
  before(:each) do
    @http_params = {:id => 'otherlogin', :since_id => 3953743, :full_name => 'Lucy Cross'}
    @id_regexp = Regexp.new("id=#{URI.encode(@http_params[:id].to_s)}")
    @since_id_regexp = Regexp.new("since_id=#{URI.encode(@http_params[:since_id].to_s)}")
    @full_name_regexp = Regexp.new("full_name=#{URI.encode(@http_params[:full_name].to_s)}")
  end
  
  it "should generate expected URL encoded string" do
    http_str = @http_params.to_http_str
    http_str.should match(@id_regexp)
    http_str.should match(@since_id_regexp)
    http_str.should match(@full_name_regexp)
  end
  
  after(:each) do
    @http_params = nil
    @id_kv_str, @since_id_kv_str, @full_name_kv_str = nil
  end
end

describe Time, "#to_s" do
  before(:each) do
    @time = Time.now
    @expected_string = @time.rfc2822
  end
  
  it "should output RFC2822 compliant string" do
    time_string = @time.to_s
    time_string.should eql(@expected_string)
  end
  
  it "should respond to #old_to_s" do
    @time.should respond_to(:old_to_s)
  end
  
  after(:each) do
    nilize(@time, @expected_string)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
twitter4r-0.3.0 spec/twitter/ext/stdlib_spec.rb
twitter4r-0.2.1 spec/twitter/ext/stdlib_spec.rb
twitter4r-0.2.5 spec/twitter/ext/stdlib_spec.rb
twitter4r-0.2.2 spec/twitter/ext/stdlib_spec.rb
twitter4r-0.2.4 spec/twitter/ext/stdlib_spec.rb
twitter4r-0.2.0 spec/twitter/ext/stdlib_spec.rb
twitter4r-0.2.3 spec/twitter/ext/stdlib_spec.rb