Skip to content

Instantly share code, notes, and snippets.

@Bodacious
Last active May 4, 2024 10:30
Show Gist options
  • Save Bodacious/92dd9307d4ec5b870bf4da667b815611 to your computer and use it in GitHub Desktop.
Save Bodacious/92dd9307d4ec5b870bf4da667b815611 to your computer and use it in GitHub Desktop.
Reply to tweet example
describe "PATCH /settings" do
context "as a partner" do
it "behaves like a user without access" do
user = create(:partner, company:)
params = { company: { website: "https://domain.suffix" } }
headers = { "Accept" => "text/vnd.turbo-stream.html" }
patch(settings_path, params: params, headers: headers)
expect(response).to be_unauthorized
end
end
context "as a mechanic" do
it "behaves like a user without access" do
user = create(:mechanic, company:)
params = { company: { website: "https://domain.suffix" } }
headers = { "Accept" => "text/vnd.turbo-stream.html" }
patch(settings_path, params: params, headers: headers)
expect(response).to be_unauthorized
end
end
context "as sales_2" do
it "behaves like a user without access" do
user = create(:sales_2, company:)
params = { company: { website: "https://domain.suffix" } }
headers = { "Accept" => "text/vnd.turbo-stream.html" }
patch(settings_path, params: params, headers: headers)
expect(response).to be_unauthorized
end
end
context "as sales" do
it "behaves like a user without access" do
user = create(:sales, company:)
params = { company: { website: "https://domain.suffix" } }
headers = { "Accept" => "text/vnd.turbo-stream.html" }
patch(settings_path, params: params, headers: headers)
expect(response).to be_unauthorized
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment