Commit 524732d4 authored by georg's avatar georg

Merge branch 'fix-rendering-error-msg-list-key' into 'master'

Fix rendering error message when list.key is not available

See merge request !68
parents d10dc9da 623e17f3
Pipeline #33712 failed with stages
in 12 minutes and 49 seconds
......@@ -17,6 +17,8 @@ class List < Base
def key
@key ||= Key.find(fingerprint, params: { list_id: self.id })
rescue ActiveResource::ResourceNotFound
nil
end
def headers_to_meta
......
require "rails_helper"
feature "User views a list" do
scenario "when the key is found but no admins present" do
email = "subscription1@example.org"
account = create(:account, email: email)
subscription1 = create(:subscription, email: email)
list = create(:list, email: email, subscriptions: [subscription1])
stub_request(
:get,
"https://localhost:4443/keys/59C71FB38AEE22E091C78259D06350440F759BD3.json?list_id=#{list.id}"
).to_return(status: 200, body: File.read(File.join(fixture_path, "key.json")))
sign_in(account)
visit(list_subscriptions_path(list))
expect(page).to have_content('This list is not functional!')
expect(page).to have_content("It needs at least one list-admin!")
WebMock.reset!
end
scenario "when the key is not found it show the error message" do
email = "subscription1@example.org"
account = create(:account, email: email)
subscription1 = create(:subscription, email: email, admin: true)
list = create(:list, email: email, subscriptions: [subscription1])
stub_request(
:get,
"https://localhost:4443/keys/59C71FB38AEE22E091C78259D06350440F759BD3.json?list_id=#{list.id}"
).to_return(status: 404, body: "[]")
sign_in(account)
visit(list_subscriptions_path(list))
expect(page).to have_content('This list is not functional!')
expect(page).to have_content("No list-key present for #{list.email}")
WebMock.reset!
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment