spec/hello_sign/client_spec.rb in hellosign-ruby-sdk-3.0.3 vs spec/hello_sign/client_spec.rb in hellosign-ruby-sdk-3.0.4
- old
+ new
@@ -1,131 +1,130 @@
require 'spec_helper'
describe HelloSign::Client do
- describe "#initialize" do
- context "with default values" do
- subject(:client){HelloSign::Client.new}
+ describe '#initialize' do
+ context 'with default values' do
+ subject(:client) { HelloSign::Client.new }
HelloSign::Configuration::VALID_OPTIONS_KEYS.each do |key|
it "should set #{key}" do
expect(client.send(key)).to eql(HelloSign.send(key))
end
end
end
- context "with custom values" do
+ context 'with custom values' do
let(:custom_client){
{
- :email_address => "email_address",
- :password => "password",
- :api_key => "api_key",
- :user_agent => "user_agent",
- :end_point => "end_point",
- :oauth_end_point => "oauth_end_point",
- :api_version => "api_version",
- :client_id => "client_id",
- :client_secret => "client_secret",
- :auth_token => "auth_token",
+ :email_address => 'email_address',
+ :password => 'password',
+ :api_key => 'api_key',
+ :user_agent => 'user_agent',
+ :end_point => 'end_point',
+ :oauth_end_point => 'oauth_end_point',
+ :api_version => 'api_version',
+ :client_id => 'client_id',
+ :client_secret => 'client_secret',
+ :auth_token => 'auth_token',
:log_level => 5,
:logging => false
}
}
- subject(:client){ HelloSign::Client.new custom_client}
+ subject(:client) { HelloSign::Client.new custom_client }
HelloSign::Configuration::VALID_OPTIONS_KEYS.each do |key|
it "should set #{key}" do
expect(client.send(key)).to eql(custom_client[key])
end
end
end
end
- describe "#request" do
- context "when response status >= 400" do
+ describe '#request' do
+ context 'when response status >= 400' do
HelloSign::Client::ERRORS.keys.each do |key|
it "raise #{HelloSign::Client::ERRORS[key].to_s} when response status #{key}" do
-
# raise when post
- stub_post("/account/create", 'error', key)
+ stub_post('/account/create', 'error', key)
expect {
- HelloSign.create_account :email_address => "test@example.com", :password => "password"
+ HelloSign.create_account :email_address => 'test@example.com', :password => 'password'
}.to raise_error(HelloSign::Client::ERRORS[key])
# raise when get
- stub_get("/account", 'error', key)
+ stub_get('/account', 'error', key)
expect {
HelloSign.get_account
}.to raise_error(HelloSign::Client::ERRORS[key])
end
end
end
end
- describe "prepare" do
- context "signers" do
- describe "is an array" do
+ describe 'prepare' do
+ context 'signers' do
+ describe 'is an array' do
before do
- stub_post("/signature_request/send", 'signature_request')
+ stub_post('/signature_request/send', 'signature_request')
end
- it "work correctly" do
- expect(lambda{HelloSign.send_signature_request(
- :files_url => ["http://hellosign.com/test.pdf"],
- :signers => ["sss"]
- )}).not_to raise_error
+ it 'work correctly' do
+ expect(lambda{ HelloSign.send_signature_request(
+ :files_url => ['http://hellosign.com/test.pdf'],
+ :signers => ['sss']
+ ) }).not_to raise_error
end
end
- describe "is an Hash" do
+ describe 'is an Hash' do
before do
- stub_post("/signature_request/send", 'signature_request')
+ stub_post('/signature_request/send', 'signature_request')
end
- it "work correctly" do
- expect(lambda{HelloSign.send_signature_request(
- :files_url => ["http://hellosign.com/test.pdf"],
+ it 'work correctly' do
+ expect(lambda{ HelloSign.send_signature_request(
+ :files_url => ['http://hellosign.com/test.pdf'],
:signers => [{
:email_address => 'jack@example.com',
:name => 'Jack',
:order => 0
- },{
+ }, {
:email_address => 'jill@example.com',
:name => 'Jill',
:order => 1
}]
- )}).not_to raise_error
+ ) }).not_to raise_error
end
end
end
- context "ccs" do
- describe "is an array" do
+ context 'ccs' do
+ describe 'is an array' do
before do
- stub_post("/signature_request/send_with_template", 'signature_request')
+ stub_post('/signature_request/send_with_template', 'signature_request')
end
- it "work correctly" do
- expect(lambda{HelloSign.send_signature_request_with_template(
- :ccs => ["sss"]
- )}).not_to raise_error
+ it 'work correctly' do
+ expect(lambda{ HelloSign.send_signature_request_with_template(
+ :ccs => ['sss']
+ ) }).not_to raise_error
end
end
- describe "is an Hash" do
+ describe 'is an Hash' do
before do
- stub_post("/signature_request/send_with_template", 'signature_request')
+ stub_post('/signature_request/send_with_template', 'signature_request')
end
- it "work correctly" do
- expect(lambda{HelloSign.send_signature_request_with_template(
+ it 'work correctly' do
+ expect(lambda{ HelloSign.send_signature_request_with_template(
:ccs => [{
:email_address => 'jack@example.com',
:name => 'Jack',
:role => 'Manager'
- },{
+ }, {
:email_address => 'jill@example.com',
:name => 'Jill',
- :role => "Client"
+ :role => 'Client'
}]
- )}).not_to raise_error
+ ) }).not_to raise_error
end
end
end
end
end