diff --git a/spec/client/users_spec.rb b/spec/client/users_spec.rb index 5067c86..a936d3a 100644 --- a/spec/client/users_spec.rb +++ b/spec/client/users_spec.rb @@ -1,11 +1,11 @@ -require "spec_helper" +require 'spec_helper' describe Oktakit::Client::Users do - USERS_USER_ID = "00u6o0w6tyuPVEeZr0h7" + USERS_USER_ID = '00u6o0w6tyuPVEeZr0h7' - describe "#create_user" do - it "returns all responses return the created user." do - VCR.use_cassette("create_user") do + describe '#create_user' do + it 'returns all responses return the created user.' do + VCR.use_cassette('create_user') do resp, = client.create_user( profile: { firstName: "Example", @@ -26,9 +26,9 @@ end end - describe "#get_user" do - it "returns fetched user" do - VCR.use_cassette("get_user") do + describe '#get_user' do + it 'returns fetched user' do + VCR.use_cassette('get_user') do resp, = client.get_user(USERS_USER_ID) expect(resp.to_h).to(have_key(:id)) expect(resp.to_h).to(have_key(:profile)) @@ -39,18 +39,18 @@ end end - describe "#list_users" do - it "returns array of user" do - VCR.use_cassette("list_users") do + describe '#list_users' do + it 'returns array of user' do + VCR.use_cassette('list_users') do resp, = client.list_users expect(resp).to(be_a(Array)) end end end - describe "#update_user" do - it "returns updated user" do - VCR.use_cassette("update_user") do + describe '#update_user' do + it 'returns updated user' do + VCR.use_cassette('update_user') do resp, = client.update_user(USERS_USER_ID, profile: { firstName: "Bob", @@ -58,14 +58,14 @@ email: "example@example.com", login: "example@example.com", }) - expect(resp.profile.firstName).to(be == "Bob") + expect(resp.profile.firstName).to(be == 'Bob') end end end - describe "#update_user partial" do - it "returns updated user" do - VCR.use_cassette("update_user_partial") do + describe '#update_user partial' do + it 'returns updated user' do + VCR.use_cassette('update_user_partial') do resp, = client.update_user(USERS_USER_ID, profile: { firstName: "Bob", @@ -74,14 +74,14 @@ login: "example@example.com", }, partial: true) - expect(resp.profile.firstName).to(be == "Bob") + expect(resp.profile.firstName).to(be == 'Bob') end end end - describe "#update_profile" do - it "returns updated user" do - VCR.use_cassette("update_profile") do + describe '#update_profile' do + it 'returns updated user' do + VCR.use_cassette('update_profile') do resp, = client.update_profile(USERS_USER_ID, profile: { firstName: "Other Bob", @@ -89,60 +89,60 @@ email: "example@example.com", login: "example@example.com", }) - expect(resp.profile.firstName).to(be == "Other Bob") + expect(resp.profile.firstName).to(be == 'Other Bob') end end end - describe "#get_assigned_app_links" do - it "returns array of app links" do - VCR.use_cassette("get_assigned_app_links") do + describe '#get_assigned_app_links' do + it 'returns array of app links' do + VCR.use_cassette('get_assigned_app_links') do resp, = client.get_assigned_app_links(USERS_USER_ID) expect(resp).to(be_a(Array)) end end end - describe "#get_member_groups" do - it "returns array of groups" do - VCR.use_cassette("get_member_groups") do + describe '#get_member_groups' do + it 'returns array of groups' do + VCR.use_cassette('get_member_groups') do resp, = client.get_member_groups(USERS_USER_ID) expect(resp).to(be_a(Array)) end end end - describe "#activate_user" do - it "returns empty object by default." do - VCR.use_cassette("activate_user") do + describe '#activate_user' do + it 'returns empty object by default.' do + VCR.use_cassette('activate_user') do resp, = client.activate_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#reactivate_user" do - it "returns activation token by default." do - VCR.use_cassette("reactivate_user") do + describe '#reactivate_user' do + it 'returns activation token by default.' do + VCR.use_cassette('reactivate_user') do resp, status = client.reactivate_user(USERS_USER_ID) expect(status).to(be == 200) - expect(resp[:activationToken]).to(be == "-9OhPWRjr7_S8t2iV5_w") + expect(resp[:activationToken]).to(be == '-9OhPWRjr7_S8t2iV5_w') end end end - describe "#deactivate_user" do - it "returns an empty object." do - VCR.use_cassette("deactivate_user") do + describe '#deactivate_user' do + it 'returns an empty object.' do + VCR.use_cassette('deactivate_user') do resp, = client.deactivate_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#delete_user" do - it "returns an empty object." do - VCR.use_cassette("delete_user") do + describe '#delete_user' do + it 'returns an empty object.' do + VCR.use_cassette('delete_user') do resp, status = client.delete_user(USERS_USER_ID) expect(resp).to(be_empty) expect(status).to(be == 204) @@ -150,63 +150,63 @@ end end - describe "#suspend_user" do - it "returns an empty object." do - VCR.use_cassette("suspend_user") do + describe '#suspend_user' do + it 'returns an empty object.' do + VCR.use_cassette('suspend_user') do resp, = client.suspend_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#unsuspend_user" do - it "returns an empty object. returns an empty object." do - VCR.use_cassette("unsuspend_user") do + describe '#unsuspend_user' do + it 'returns an empty object. returns an empty object.' do + VCR.use_cassette('unsuspend_user') do resp, = client.unsuspend_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#unlock_user" do - it "returns an empty object" do - VCR.use_cassette("unlock_user") do + describe '#unlock_user' do + it 'returns an empty object' do + VCR.use_cassette('unlock_user') do _, status = client.unlock_user(USERS_USER_ID) expect(status).to(be(200)) end end end - describe "#reset_password" do - it "returns an empty object by default." do - VCR.use_cassette("reset_password") do + describe '#reset_password' do + it 'returns an empty object by default.' do + VCR.use_cassette('reset_password') do resp, = client.reset_password(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#expire_password" do - it "returns the complete user object by default." do - VCR.use_cassette("expire_password") do + describe '#expire_password' do + it 'returns the complete user object by default.' do + VCR.use_cassette('expire_password') do resp, = client.expire_password(USERS_USER_ID) - expect(resp.status).to(be == "PASSWORD_EXPIRED") + expect(resp.status).to(be == 'PASSWORD_EXPIRED') end end end - describe "#reset_factors" do - it "returns an empty object by default." do - VCR.use_cassette("reset_factors") do + describe '#reset_factors' do + it 'returns an empty object by default.' do + VCR.use_cassette('reset_factors') do resp, = client.reset_factors(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#forgot_password" do - it "returns an empty object by default." do - VCR.use_cassette("forgot_password") do + describe '#forgot_password' do + it 'returns an empty object by default.' do + VCR.use_cassette('forgot_password') do resp, = client.forgot_password( USERS_USER_ID, password: { value: "123Password!" }, @@ -217,9 +217,9 @@ end end - describe "#change_password" do - it "returns credentials of the user" do - VCR.use_cassette("change_password") do + describe '#change_password' do + it 'returns credentials of the user' do + VCR.use_cassette('change_password') do _, status = client.change_password(USERS_USER_ID, oldPassword: { value: "uTVM,TPw55" }, newPassword: { value: "NewPassword1234!" }) @@ -228,9 +228,9 @@ end end - describe "#change_recovery_question" do - it "returns credentials of the user" do - VCR.use_cassette("change_recovery_question") do + describe '#change_recovery_question' do + it 'returns credentials of the user' do + VCR.use_cassette('change_recovery_question') do resp, = client.change_recovery_question(USERS_USER_ID, password: { value: "NewPassword1234!" }, recovery_question: { @@ -242,9 +242,9 @@ end end - describe "#clear_user_sessions" do - it "returns 204 no content" do - VCR.use_cassette("clear_user_sessions") do + describe '#clear_user_sessions' do + it 'returns 204 no content' do + VCR.use_cassette('clear_user_sessions') do _, status = client.clear_user_sessions(USERS_USER_ID) expect(status).to(be(204)) end