spec/checker/http_spec.rb in eye-0.2 vs spec/checker/http_spec.rb in eye-0.2.1
- old
+ new
@@ -16,11 +16,11 @@
subject{ chhttp }
it "initialize" do
subject.instance_variable_get(:@kind).should == Net::HTTPSuccess
subject.instance_variable_get(:@pattern).should == /OK/
- subject.instance_variable_get(:@open_timeout).should == 2
+ subject.instance_variable_get(:@open_timeout).should == 3
subject.instance_variable_get(:@read_timeout).should == 2
end
it "without url" do
chhttp(:url => nil).uri.should == URI.parse('http://127.0.0.1')
@@ -32,20 +32,25 @@
subject.human_value(subject.get_value).should == "200=0Kb"
end
it "get_value exception" do
+ a = ""
+ stub(subject).session{ a }
stub(subject.session).start{ raise Timeout::Error, "timeout" }
- subject.get_value.should == {:exception => :timeout}
+ mes = RUBY_VERSION < '2.0' ? "Timeout<3.0,2.0>" : "ReadTimeout<2.0>"
- subject.human_value(subject.get_value).should == "T-out"
+ subject.get_value.should == {:exception => mes}
+ subject.human_value(subject.get_value).should == mes
end
it "get_value raised" do
+ a = ""
+ stub(subject).session{ a }
stub(subject.session).start{ raise "something" }
- subject.get_value.should == {:exception => "something"}
+ subject.get_value.should == {:exception => "Error<something>"}
- subject.human_value(subject.get_value).should == "Err"
+ subject.human_value(subject.get_value).should == "Error<something>"
end
end
describe "good?" do
\ No newline at end of file