Skip to content

Commit

Permalink
Oops, forgot to add a spec for that last part.
Browse files Browse the repository at this point in the history
  • Loading branch information
phiggins committed Oct 2, 2010
1 parent f7b5919 commit cf63104
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/curb_spec.rb
Expand Up @@ -104,6 +104,34 @@
@curl.http_get
test.should == true
end

it "should call callbacks in correct order on successful request" do
stub_request(:any, "example.com")
order = []
@curl.on_success {|*args| order << :on_success }
@curl.on_failure {|*args| order << :on_failure }
@curl.on_header {|*args| order << :on_header }
@curl.on_body {|*args| order << :on_body }
@curl.on_complete {|*args| order << :on_complete }
@curl.on_progress {|*args| order << :on_progress }
@curl.http_get

order.should == [:on_progress,:on_header,:on_body,:on_complete,:on_success]
end

it "should call callbacks in correct order on successful request" do
stub_request(:any, "example.com").to_return(:status => [500, ""])
order = []
@curl.on_success {|*args| order << :on_success }
@curl.on_failure {|*args| order << :on_failure }
@curl.on_header {|*args| order << :on_header }
@curl.on_body {|*args| order << :on_body }
@curl.on_complete {|*args| order << :on_complete }
@curl.on_progress {|*args| order << :on_progress }
@curl.http_get

order.should == [:on_progress,:on_header,:on_body,:on_complete,:on_failure]
end
end
end

Expand Down

0 comments on commit cf63104

Please sign in to comment.