spec/link-checker_spec.rb in link-checker-0.1.0 vs spec/link-checker_spec.rb in link-checker-0.1.1

- old
+ new

@@ -62,19 +62,27 @@ end describe "prints output" do it "prints green when the links are all good." do - LinkChecker.stub(:check_link) { true } + LinkChecker.stub(:check_link) { LinkChecker::Good.new } $stdout.should_receive(:puts).with(/Checked/i).exactly(3).times LinkChecker.new(@site_path).check_links end - it "prints green when the links are all bad." do + it "prints red when the links are all bad." do LinkChecker.stub(:check_link).and_raise LinkChecker::Error.new('blah') $stdout.should_receive(:puts).with(/Problem/i).exactly(3).times $stdout.should_receive(:puts).with(/Link/i).at_least(3).times $stdout.should_receive(:puts).with(/Response/i).at_least(3).times + LinkChecker.new(@site_path).check_links + end + + it "prints yellow warnings when the links redirect." do + LinkChecker.stub(:check_link) { LinkChecker::Redirect.new('http://somewhere') } + $stdout.should_receive(:puts).with(/Checked/i).exactly(3).times + $stdout.should_receive(:puts).with(/Warning/i).at_least(3).times + $stdout.should_receive(:puts).with(/Redirected/i).at_least(3).times LinkChecker.new(@site_path).check_links end end \ No newline at end of file