spec/http_spec.rb in afmotion-2.6 vs spec/http_spec.rb in afmotion-3.0

- old
+ new

@@ -2,10 +2,23 @@ modules = [AFMotion::HTTP, AFMotion::JSON, AFMotion::XML, AFMotion::PLIST] modules.each do |_module| describe _module.to_s do + extend WebStub::SpecHelpers + + before do + disable_network_access! + @result = nil + end + + after do + enable_network_access! + reset_stubs + end + + it "should have all the HTTP methods" do AFMotion::HTTP_METHODS.each do |method| _module.respond_to?(method).should == true end end @@ -14,19 +27,36 @@ before do @result = nil end it "should work with string" do - _module.get("http://google.com") do |result| + _module.get("https://google.com") do |result| @result = result resume end wait_max(10) do @result.nil?.should == false end end end + + describe ".head" do + before do + @result = nil + end + + it "should work with string" do + _module.head("http://google.com") do |result| + @result = result + resume + end + wait_max(10) do + @result.nil?.should == false + end + end + end + end end describe "AFMotion::Image" do before do @@ -43,6 +73,6 @@ @result.nil?.should == false @result.object.is_a?(UIImage).should == true end end end -end \ No newline at end of file +end