2022-01-21 22:40:10 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "rails_helper"
|
|
|
|
|
|
|
|
describe FeedbackHelper, type: :helper do
|
|
|
|
before do
|
|
|
|
stub_const("APP_CONFIG", {
|
2022-01-21 23:16:55 -08:00
|
|
|
"hostname" => "example.com",
|
|
|
|
"https" => true,
|
|
|
|
"items_per_page" => 5,
|
|
|
|
"canny" => {
|
|
|
|
sso: "sso",
|
|
|
|
feature_board: "feature",
|
2023-10-18 14:26:10 -07:00
|
|
|
bug_board: "bug",
|
|
|
|
},
|
|
|
|
},)
|
2022-01-21 22:40:10 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#canny_token" do
|
|
|
|
context "user signed in" do
|
2022-01-21 23:16:55 -08:00
|
|
|
let(:user) { FactoryBot.create(:user, id: 10, screen_name: "canned_laughter", email: "can@do.com") }
|
2022-01-21 22:40:10 -08:00
|
|
|
|
2022-01-21 23:16:55 -08:00
|
|
|
before(:each) do
|
2022-01-21 22:40:10 -08:00
|
|
|
sign_in(user)
|
2022-01-21 23:16:55 -08:00
|
|
|
end
|
2022-01-21 22:40:10 -08:00
|
|
|
|
|
|
|
it "should return a proper token" do
|
|
|
|
expect(helper.canny_token).to eq("eyJhbGciOiJIUzI1NiJ9.eyJhdmF0YXJVUkwiOiIvaW1hZ2VzL2xhcmdlL25vX2F2YXRhci5wbmciLCJuYW1lIjoiY2FubmVkX2xhdWdodGVyIiwiaWQiOjEwLCJlbWFpbCI6ImNhbkBkby5jb20ifQ.aRZn8kAezMJucYQV4RXiMPvhSRVR3wKp1ZQtcsIWaaE")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "user not signed in" do
|
|
|
|
it "should return nothing" do
|
|
|
|
expect(helper.canny_token).to eq(nil)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-01-21 23:16:55 -08:00
|
|
|
end
|