Initial commit
This commit is contained in:
20
spec/api/v2/entities/activities_spec.rb
Normal file
20
spec/api/v2/entities/activities_spec.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe API::V2::Entities::Activity do
|
||||
let!(:create_member_permission) do
|
||||
create :permission,
|
||||
role: 'member'
|
||||
end
|
||||
let(:record) { create(:activity, topic: 'otp', result: 'succeed', action: 'login') }
|
||||
|
||||
subject { OpenStruct.new API::V2::Entities::Activity.represent(record).serializable_hash }
|
||||
|
||||
it { expect(subject.topic).to eq record.topic }
|
||||
it { expect(subject.result).to eq record.result }
|
||||
it { expect(subject.user_ip).to eq record.user_ip }
|
||||
it { expect(subject.action).to eq record.action }
|
||||
it { expect(subject.data).to eq record.data }
|
||||
it { expect(subject.user_agent).to eq record.user_agent }
|
||||
|
||||
it { expect(subject.created_at).to eq record.created_at.iso8601 }
|
||||
end
|
||||
17
spec/api/v2/entities/labels_spec.rb
Normal file
17
spec/api/v2/entities/labels_spec.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe API::V2::Entities::Label do
|
||||
let!(:create_member_permission) do
|
||||
create :permission,
|
||||
role: 'member'
|
||||
end
|
||||
let(:record) { create(:label) }
|
||||
|
||||
subject { OpenStruct.new API::V2::Entities::Label.represent(record).serializable_hash }
|
||||
|
||||
it { expect(subject.key).to eq record.key }
|
||||
it { expect(subject.value).to eq record.value }
|
||||
it { expect(subject.scope).to eq record.scope }
|
||||
it { expect(subject.created_at).to eq record.created_at.iso8601 }
|
||||
it { expect(subject.updated_at).to eq record.updated_at&.iso8601 }
|
||||
end
|
||||
27
spec/api/v2/entities/user_with_full_spec.rb
Normal file
27
spec/api/v2/entities/user_with_full_spec.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe API::V2::Entities::UserWithKYC do
|
||||
let!(:create_member_permission) do
|
||||
create :permission,
|
||||
role: 'member'
|
||||
end
|
||||
let(:record) { create(:user) }
|
||||
|
||||
subject { OpenStruct.new API::V2::Entities::UserWithKYC.represent(record).serializable_hash }
|
||||
|
||||
it { expect(subject.email).to eq record.email }
|
||||
it { expect(subject.uid).to eq record.uid }
|
||||
it { expect(subject.role).to eq record.role }
|
||||
it { expect(subject.level).to eq record.level }
|
||||
it { expect(subject.otp).to eq record.otp }
|
||||
it { expect(subject.state).to eq record.state }
|
||||
it { expect(subject.profiles).to eq record.profiles }
|
||||
it { expect(subject.labels).to eq record.labels }
|
||||
it { expect(subject.phones).to eq record.phones }
|
||||
it { expect(subject.documents).to eq record.documents }
|
||||
it { expect(subject.to_h.keys).not_to include(:activities) }
|
||||
|
||||
it { expect(subject.created_at).to eq record.created_at.iso8601 }
|
||||
it { expect(subject.updated_at).to eq record.updated_at&.iso8601 }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user