Add spec for CurrenUserSerializer

Add spec for CurrenUserSerializer

diff --git a/spec/serializers/current_user_serializer_spec.rb b/spec/serializers/current_user_serializer_spec.rb
new file mode 100644
index 0000000..b3e79c3
--- /dev/null
+++ b/spec/serializers/current_user_serializer_spec.rb
@@ -0,0 +1,27 @@
+require 'rails_helper'
+
+describe CurrentUserSerializer do
+  let(:user) { Fabricate(:user) }
+  let :serializer do
+    CurrentUserSerializer.new(user, scope: Guardian.new, root: false)
+  end
+
+  before do
+    SiteSetting.intercom_enabled = true
+    SiteSetting.intercom_secret_key = "ABCDE123"
+  end
+
+  it "should add current user email and intercom hash" do
+    payload = serializer.as_json
+    expect(payload[:email]).to eq(user.email)
+    expect(payload[:intercom_hash]).to be_present
+  end
+
+  it "should not add current user email and intercom hash" do
+    SiteSetting.intercom_enabled = false
+    payload = serializer.as_json
+    expect(payload[:email]).not_to be_present
+    expect(payload[:intercom_hash]).not_to be_present
+  end
+
+end

GitHub sha: cc0ec4fe087c6d810786e6438ca1d42ab9a9925e