docbrown/spec/requests/service_worker_spec.rb
Julianna Tetreault ca6ba1af7d
Replace collective_noun with community_name (#11846) [deploy]
* Removes collective_noun and collective_noun_disabled from app

* Config Generalization: replaces community_qualified_name with community_name
  - Generalizes SiteConfig after the removal of collective_noun field
  - Updates copy where necessary to be readable with community_name
  - Makes the community_name SiteConfig description more explicit
  - Adds flexibility for Admins by removing appended "community"

* Adds a data_update script to remove collective_noun and collective_noun_disabled

* Removes appended community from stories_controller.rb

* Removes unnecessary quotation marks around SiteConfig.community_name.to_s

* Makes SiteConfig community_name description more explicit

* Removes topic from #email_from and replaces arg with _

* Removes argument from #email_from (facepalm)

* Reverts changes to application_mailer and notify_mailer_spec

* Removes default "Community" topic from application_mailer and makes topic optional

* Refactors #prepopulate_new_form to resolve Code Climate failures

* Refactors #email_from even further by use of a ternary operator per review suggestion

* Simplifies the data_update script used to remove collective_noun per review request

* Adds a data_update script to append community to community_name

* Updates data_update script to correctly append Community to community_name

* Removes RemoveCollectiveNounFromConfig and updates other script

* Removes superfluous false from data_update script

* Updates data_update script to be more idiomatic
2020-12-28 09:34:17 -07:00

37 lines
1.1 KiB
Ruby

require "rails_helper"
RSpec.describe "ServiceWorker", type: :request do
describe "GET /serviceworker.js" do
it "renders file with proper text" do
get "/serviceworker.js"
expect(response.body).to include("Serviceworkers file")
end
it "renders javascript file" do
get "/serviceworker.js"
expect(response.header["Content-Type"]).to include("text/javascript")
end
it "sends a surrogate key (for Fastly's user)" do
get "/serviceworker.js"
expect(response.header["Surrogate-Key"]).to include("serviceworker-js")
end
end
describe "GET /manifest.json" do
it "renders file with proper text" do
get "/manifest.json"
expect(response.body).to include("\"name\": \"#{SiteConfig.community_name}\"")
end
it "renders json file" do
get "/manifest.json"
expect(response.header["Content-Type"]).to include("application/json")
end
it "sends a surrogate key (for Fastly's user)" do
get "/manifest.json"
expect(response.header["Surrogate-Key"]).to include("manifest-json")
end
end
end