spec/thread_spec.rb in mona-0.1.0 vs spec/thread_spec.rb in mona-0.2.0

- old
+ new

@@ -30,9 +30,25 @@ lambda { subject.parse_body test_dat.toutf8 }.should change(subject, :title).from(nil).to('ウツ病のプログラマーを雇うスレ') end end + + describe :from_url do + context "with valid url: http://news2.2ch.net/test/read.cgi/newsplus/1000000000/" do + subject { Mona::Thread.from_url "http://news2.2ch.net/test/read.cgi/newsplus/1000000000/" } + its("board.host") { should == "news2.2ch.net" } + its("board.board") { should == "newsplus" } + its(:id) { should == 1000000000 } + end + context "with invalid url" do + it do + lambda { + Mona::Thread.from_url "http://news2.2ch.net/test/hoge/read.cgi/newsplus/1000000000/" + }.should raise_error("Invalid Url") + end + end + end end describe Mona::Thread, 'real' do subject { Mona::Thread.new(board: Mona::Board.new('hibari.2ch.net', 'prog'), id: 1210150210) } it "reload should change last_accessed_at" do