Fix invalid feed error display in settings (#11695)
This commit is contained in:
parent
c5a29826e8
commit
201492c95b
3 changed files with 20 additions and 4 deletions
|
|
@ -51,7 +51,7 @@
|
|||
</div>
|
||||
|
||||
<%= f.hidden_field :tab, value: @tab %>
|
||||
<% button_text = @user.feed_url.present? ? "Save" : "Submit" %>
|
||||
<% button_text = @user.feed_url.present? ? "Save Feed Settings" : "Submit Feed Settings" %>
|
||||
<div><button class="crayons-btn" type="submit"><%= button_text %></button></div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<%= form_with model: @response_template do |f| %>
|
||||
<section class="flex flex-col gap-3">
|
||||
<% if @response_template.persisted? %>
|
||||
<% if @response_template&.persisted? %>
|
||||
<% title = params[:previous_title] || @response_template.title %>
|
||||
<% content = params[:previous_content] || @response_template.content %>
|
||||
<h3 class="crayons-subtitle-3">
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ RSpec.describe "User edits their extensions", type: :system, js: true do
|
|||
.to_return(status: 200, body: github_response_body.to_json, headers: { "Content-Type" => "application/json" })
|
||||
end
|
||||
|
||||
describe "via visiting /settings" do
|
||||
describe "Stackbit" do
|
||||
before do
|
||||
visit "/settings"
|
||||
visit user_settings_path
|
||||
end
|
||||
|
||||
it "has connect-to-stackbit prompt" do
|
||||
|
|
@ -37,4 +37,20 @@ RSpec.describe "User edits their extensions", type: :system, js: true do
|
|||
expect(page).to have_text("Connected to Stackbit")
|
||||
end
|
||||
end
|
||||
|
||||
describe "Feed" do
|
||||
before do
|
||||
visit user_settings_path(:extensions)
|
||||
end
|
||||
|
||||
it "fails if the feed URL is invalid" do
|
||||
stub_request(:get, "https://medium.com/feed/alkdmksadksa")
|
||||
.to_return(status: 200, body: "not an xml feed")
|
||||
|
||||
fill_in "user[feed_url]", with: "https://medium.com/feed/alkdmksadksa"
|
||||
click_on "Submit Feed Settings"
|
||||
|
||||
expect(page).to have_text("Feed url is not a valid RSS/Atom feed")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue