Sha256: 5089fe0136d79dc411d2bba2346f8c63cf424e8546daec7b5386f0b3c32a271c

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'

describe Reddit::CommentList do
  before do
    @comments_list = Reddit::CommentList.new('id')
  end
  
  it "should know its url" do
    @comments_list.url.should == Reddit::COMMENTS_URL.gsub('[id]', 'id')
  end
  
  it "should fetch the top level comments" do
    mock_comment = mock(Reddit::Comment)
    
    @comments_list.should_receive(:get_resources).and_return([mock_comment, mock_comment])
    
    @comments_list.top_level.should == [mock_comment, mock_comment]
  end
  
  it "should redirect method calls to the top level comments" do
    top_level_mock = mock('top_level')
    top_level_mock.should_receive(:[]).and_return("array")
    @comments_list.stub!(:top_level).and_return(top_level_mock)
    
    @comments_list[1].should == "array"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bterlson-reddit-0.3.0 spec/comment_list_spec.rb