Sha256: dd67dbf68a79bf5eff6617b14fc5df177f90d7ee9fb646c410310a271b5b7a62
Contents?: true
Size: 1012 Bytes
Versions: 36
Compression:
Stored size: 1012 Bytes
Contents
require 'core/spec_helper' describe ZendeskAPI::CreateResource do context "create" do let(:attr) { { :test_field => "blah" } } subject { ZendeskAPI::TestResource } before(:each) do stub_request(:post, %r{test_resources}).to_return(:body => json) end it "should return instance of resource" do subject.create(client, attr).should be_instance_of(subject) end context "with client error" do before(:each) do stub_request(:post, %r{test_resources}).to_return(:status => 500) end it "should handle it properly" do expect { silence_logger { subject.create(client, attr).should be_nil } }.to_not raise_error end end end context "create!" do subject { ZendeskAPI::TestResource } before(:each) do stub_request(:post, %r{test_resources}).to_return(:status => 500) end it "should raise if save fails" do expect { subject.create!(client, :test_field => "blah") }.to raise_error end end end
Version data entries
36 entries across 36 versions & 1 rubygems