test/createsend_test.rb in createsend-0.0.2 vs test/createsend_test.rb in createsend-0.1.0
- old
+ new
@@ -62,33 +62,33 @@
["404", "Not Found"] => NotFound,
["500", "Server Error"] => ServerError
}.each do |status, exception|
context "#{status.first}, a get" do
should "raise a #{exception.name} error" do
- stub_get(@api_key, "countries.json", status.first == '400' ? 'custom_api_error.json' : nil, status)
+ stub_get(@api_key, "countries.json", (status.first == '400' or status.first == '401') ? 'custom_api_error.json' : nil, status)
lambda { c = @cs.countries }.should raise_error(exception)
end
end
context "#{status.first}, a post" do
should "raise a #{exception.name} error" do
- stub_post(@api_key, "clients.json", status.first == '400' ? 'custom_api_error.json' : nil, status)
+ stub_post(@api_key, "clients.json", (status.first == '400' or status.first == '401') ? 'custom_api_error.json' : nil, status)
lambda { Client.create "Client Company Name", "Client Contact Name", "client@example.com",
"(GMT+10:00) Canberra, Melbourne, Sydney", "Australia" }.should raise_error(exception)
end
end
context "#{status.first}, a put" do
should "raise a #{exception.name} error" do
- stub_put(@api_key, "templates/#{@template.template_id}.json", status.first == '400' ? 'custom_api_error.json' : nil, status)
+ stub_put(@api_key, "templates/#{@template.template_id}.json", (status.first == '400' or status.first == '401') ? 'custom_api_error.json' : nil, status)
lambda { @template.update "Template One Updated", "http://templates.org/index.html",
"http://templates.org/files.zip", "http://templates.org/screenshot.jpg" }.should raise_error(exception)
end
end
context "#{status.first}, a delete" do
should "raise a #{exception.name} error" do
- stub_delete(@api_key, "templates/#{@template.template_id}.json", status.first == '400' ? 'custom_api_error.json' : nil, status)
+ stub_delete(@api_key, "templates/#{@template.template_id}.json", (status.first == '400' or status.first == '401') ? 'custom_api_error.json' : nil, status)
lambda { @template.delete }.should raise_error(exception)
end
end
end
end