spec/actionkit_spec.rb in tokyo_api-0.2.0 vs spec/actionkit_spec.rb in tokyo_api-0.6.1
- old
+ new
@@ -3,11 +3,11 @@
describe TokyoApi::Actionkit do
subject { TokyoApi.new(host: 'test.com') }
describe 'configuration' do
it 'should propagate the host' do
- subject.actionkit.client.connection.configuration.host.should == 'test.com'
+ expect(subject.actionkit.client.connection.configuration.host).to eq('test.com')
end
end
describe 'full_user' do
let(:body) { fixture('responses/full_user_success') }
@@ -20,25 +20,35 @@
end
describe 'error' do
let(:body) { fixture('responses/full_user_error') }
- it 'should find an organisation' do
- subject.actionkit.full_user('1').should == {'error' => 'Connection refused'}
+ it 'should return an error hash' do
+ expect(subject.actionkit.full_user('1')).to eq({'error' => 'Connection refused'})
end
end
- describe 'error' do
- let(:body) { fixture('responses/full_user_success') } #TODO: actually figure out what this returns.
+ describe 'success' do
+ let(:body) { fixture('responses/actionkit/full_user_success') }
- it 'should find an organisation' do
- subject.actionkit.full_user('1').should == nil
+ it 'should return a user message' do
+ expect(subject.actionkit.full_user('1')).to eq({ 'first_name' => 'Homer', 'last_name' => 'Simpson',
+ 'city' => 'Springfield', 'state' => 'YZ', 'country' => 'US',
+ 'extra_field' => 'hidden extra field', 'email' => 'foo@bar.com' })
end
end
describe 'user_path' do
- it "should return relative path to user API endpoint" do
- subject.actionkit.user_path('abc.123.xyz').should == '/actionkit/user/abc.123.xyz'
+ context 'phone not required' do
+ it "should return relative path to user API endpoint" do
+ expect(subject.actionkit.user_path('abc.123.xyz', false)).to eq('/actionkit/user/abc.123.xyz?phone_required=false')
+ end
+ end
+
+ context 'phone required' do
+ it "should return relative path to user API endpoint" do
+ expect(subject.actionkit.user_path('abc.123.xyz', true)).to eq('/actionkit/user/abc.123.xyz?phone_required=true')
+ end
end
end
end
end