* Remove unused constant * Remove unused column from OrganizationMembership * Remove outdated comment * Remove references to no longer existing roles * Remove legacy service worker code * Remove duration_in_seconds_column from podcast_episodes * Remove app_bundle from devices
33 lines
1,021 B
Ruby
33 lines
1,021 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "AsyncInfo", type: :request do
|
|
let(:controller_instance) { AsyncInfoController.new }
|
|
|
|
before do
|
|
allow(AsyncInfoController).to receive(:new).and_return(controller_instance)
|
|
end
|
|
|
|
describe "GET /async_info/base_data" do
|
|
context "when not logged-in" do
|
|
it "returns json without user" do
|
|
get "/async_info/base_data"
|
|
expect(response.parsed_body.keys).to match_array(%w[broadcast param token])
|
|
end
|
|
|
|
it "renders normal response even if the Forem instance is private" do
|
|
allow(Settings::UserExperience).to receive(:public).and_return(false)
|
|
get "/async_info/base_data"
|
|
expect(response.parsed_body.keys).to match_array(%w[broadcast param token])
|
|
end
|
|
end
|
|
|
|
context "when logged in" do
|
|
it "returns token and user" do
|
|
sign_in create(:user)
|
|
|
|
get "/async_info/base_data"
|
|
expect(response.parsed_body.keys).to match_array(%w[broadcast param token user])
|
|
end
|
|
end
|
|
end
|
|
end
|