Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/spina/admin/embeds_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def embed_type
end

def embed_params
params.require(:embeddable).permit!
params.permit(embeddable: {}).fetch(:embeddable, {})
end
end
end
Expand Down
33 changes: 33 additions & 0 deletions test/functional/spina/admin/embeds_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require "test_helper"

module Spina
module Admin
class EmbedsControllerTest < ActionController::TestCase
setup do
@routes = Spina::Engine.routes
@account = FactoryBot.create(:account)
@user = FactoryBot.create(:user)
@controller.stubs(:current_spina_user).returns(@user)
end

test "should work with normal nested embeddable params" do
post :create, params: {
embed_type: "Spina::Embeds::YouTube",
embeddable: {
url: "https://www.youtube.com/watch?v=dQw4w9wgxcq"
}
}, format: :turbo_stream

assert_response :success
end

test "should create embeddable with no attributes (no embeddable param sent)" do
post :create, params: {
embed_type: "Spina::Embeds::YouTube"
}, format: :turbo_stream

assert_response :success
end
end
end
end
Loading