Ability to Mark Podcasts as Published in Admin Podcasts (#11024) [deploy]
* Adds ability to publish/unpublish Podcasts via /admin/podacasts/id/edit - Moves ability to Admin to remove reliability of resource_admin - Adds published to podcast_params in Admin::PodcastsController * Adds a test to check the successful publishing of a podcast in podcasts_spec.rb * Reverts change to podcast.reload in podcasts_spec.rb
This commit is contained in:
parent
82d659be8f
commit
1733c88a07
3 changed files with 13 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -64,6 +64,13 @@
|
|||
<%= f.label :feed_url, for: "podcast_feed_url" %>
|
||||
<%= f.text_field :feed_url, class: "form-control" %>
|
||||
</div>
|
||||
<div class="crayons-field crayons-field--checkbox">
|
||||
<%= f.check_box "published", class: "crayons-checkbox" %>
|
||||
<label class="crayons-field__label" for="published">
|
||||
Published
|
||||
</label>
|
||||
</div>
|
||||
<br>
|
||||
<%= f.submit class: "btn btn-primary" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue