Sha256: 36a7139139fda4b7c018c07e3028a651f32bb9dc2dba67393b5a9ca7b5789259
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' require File.expand_path(File.dirname(__FILE__) + '/parser_helper') module RubyHackernews describe CommentsInfoParser do before(:each) do @line = ParserHelper.second_line @comment_link = "item?id=1645686" end describe :parse do it "should not call CommentsInfo.new if comment tag is missing" do parser = CommentsInfoParser.new(ParserHelper.second_line_comments_tag_missing) CommentsInfo.should_not_receive(:new) parser.parse end it "should call CommentsInfo.new with comments count if not 'discuss'" do parser = CommentsInfoParser.new(@line) CommentsInfo.should_receive(:new).with(2, anything) parser.parse end it "should call CommentsInfo.new with 0 if is 'discuss'" do parser = CommentsInfoParser.new(ParserHelper.second_line_no_comments_yet) CommentsInfo.should_receive(:new).with(0, anything) parser.parse end it "should call CommentsInfo.new with comment link" do parser = CommentsInfoParser.new(@line) CommentsInfo.should_receive(:new).with(anything, @comment_link) parser.parse end end end end
Version data entries
4 entries across 4 versions & 1 rubygems