Sha256: f3c550a4f2c5db1dc274a81e988e6113c4fd476567dca192486bfaa360a51a1a
Contents?: true
Size: 1.39 KB
Versions: 8
Compression:
Stored size: 1.39 KB
Contents
require 'spec_helper' describe Zoomus::Actions::User do before :all do @zc = zoomus_client @args = {:email => "foo@bar.com", :first_name => "Foo", :last_name => "Bar", :type => 1} end describe "#user_custcreate action" do before :each do stub_request(:post, zoomus_url("/user/custcreate")).to_return(:body => json_response("user_custcreate")) end it "requires email param" do expect{@zc.user_custcreate(filter_key(@args, :email))}.to raise_error(ArgumentError) end it "requires type param" do expect{@zc.user_custcreate(filter_key(@args, :type))}.to raise_error(ArgumentError) end it "returns a hash" do expect(@zc.user_custcreate(@args)).to be_kind_of(Hash) end it "returns same params" do res = @zc.user_custcreate(@args) expect(res["email"]).to eq(@args[:email]) expect(res["first_name"]).to eq(@args[:first_name]) expect(res["last_name"]).to eq(@args[:last_name]) expect(res["type"]).to eq(@args[:type]) end end describe "#user_custcreate! action" do before :each do stub_request( :post, zoomus_url("/user/custcreate") ).to_return(:body => json_response("error")) end it "raises Zoomus::Error exception" do expect { @zc.user_custcreate!(@args) }.to raise_error(Zoomus::Error) end end end
Version data entries
8 entries across 8 versions & 1 rubygems