diff --git a/app/controllers/admin/podcasts_controller.rb b/app/controllers/admin/podcasts_controller.rb
index 8e6223543..cea349fad 100644
--- a/app/controllers/admin/podcasts_controller.rb
+++ b/app/controllers/admin/podcasts_controller.rb
@@ -65,7 +65,7 @@ module Admin
def podcast_params
allowed_params = %i[
- title feed_url
+ title feed_url published
]
params.require(:podcast).permit(allowed_params)
end
diff --git a/app/views/admin/podcasts/edit.html.erb b/app/views/admin/podcasts/edit.html.erb
index f8148e949..cc2abf3a8 100644
--- a/app/views/admin/podcasts/edit.html.erb
+++ b/app/views/admin/podcasts/edit.html.erb
@@ -64,6 +64,13 @@
<%= f.label :feed_url, for: "podcast_feed_url" %>
<%= f.text_field :feed_url, class: "form-control" %>
+
+ <%= f.check_box "published", class: "crayons-checkbox" %>
+
+
+
<%= f.submit class: "btn btn-primary" %>
<% end %>
diff --git a/spec/requests/admin/podcasts_spec.rb b/spec/requests/admin/podcasts_spec.rb
index 3e302735d..25359d21c 100644
--- a/spec/requests/admin/podcasts_spec.rb
+++ b/spec/requests/admin/podcasts_spec.rb
@@ -2,7 +2,7 @@ require "rails_helper"
RSpec.describe "/admin/podcasts", type: :request do
let(:admin) { create(:user, :super_admin) }
- let(:podcast) { create(:podcast) }
+ let(:podcast) { create(:podcast, published: false) }
let(:user) { create(:user) }
before do
@@ -60,12 +60,14 @@ RSpec.describe "/admin/podcasts", type: :request do
end
describe "Updating" do
- it "updates" do
+ it "updates the podcast" do
put admin_podcast_path(podcast), params: { podcast: { title: "hello",
- feed_url: "https://pod.example.com/rss.rss" } }
+ feed_url: "https://pod.example.com/rss.rss",
+ published: true } }
podcast.reload
expect(podcast.title).to eq("hello")
expect(podcast.feed_url).to eq("https://pod.example.com/rss.rss")
+ expect(podcast.published).to eq(true)
end
it "redirects after update" do