diff --git a/app/views/users/_publishing_from_rss.html.erb b/app/views/users/_publishing_from_rss.html.erb index 1f0af80c7..9467c45ef 100644 --- a/app/views/users/_publishing_from_rss.html.erb +++ b/app/views/users/_publishing_from_rss.html.erb @@ -51,7 +51,7 @@ <%= 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" %>
<% end %> diff --git a/app/views/users/_response_templates.html.erb b/app/views/users/_response_templates.html.erb index ba6d8b8f1..fbc9fd384 100644 --- a/app/views/users/_response_templates.html.erb +++ b/app/views/users/_response_templates.html.erb @@ -33,7 +33,7 @@ <%= form_with model: @response_template do |f| %>
- <% if @response_template.persisted? %> + <% if @response_template&.persisted? %> <% title = params[:previous_title] || @response_template.title %> <% content = params[:previous_content] || @response_template.content %>

diff --git a/spec/system/user/user_edits_extensions_spec.rb b/spec/system/user/user_edits_extensions_spec.rb index c83a41371..72af98f94 100644 --- a/spec/system/user/user_edits_extensions_spec.rb +++ b/spec/system/user/user_edits_extensions_spec.rb @@ -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