Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error when routing with array containing symbol.
- Loading branch information
Jake Wesorick
committed
Oct 15, 2019
1 parent
46c83e2
commit ec33961
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe ActiveAdmin::ResourceController::PolymorphicRoutes, type: :controller do | ||
let(:klass) { Admin::PostsController } | ||
|
||
shared_context 'with post config' do | ||
before do | ||
load_resources { post_config } | ||
|
||
@controller = klass.new | ||
|
||
get :index | ||
end | ||
end | ||
|
||
context 'polymorphic routes' do | ||
include_context 'with post config' do | ||
let(:post_config) { ActiveAdmin.register Post } | ||
let(:post) { Post.create! title: "Hello World" } | ||
end | ||
|
||
%w(polymorphic_url polymorphic_path).each do |method| | ||
describe method do | ||
it 'arrays wtih action names' do | ||
expect(controller.send(method, [:admin, post])).to include("/admin/posts/#{post.id}") | ||
end | ||
end | ||
end | ||
end | ||
end |