Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #19947 - Fix creating bookmarks for global params #4661

Merged
merged 1 commit into from Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/validators/bookmark_controller_validator.rb
Expand Up @@ -6,7 +6,7 @@ def validate_each(record, attribute, value)
end

def self.valid_controllers_list
@valid_controllers_list ||= (["dashboard"] +
@valid_controllers_list ||= (["dashboard", "common_parameters"] +
ActiveRecord::Base.connection.tables.map(&:to_s) +
Permission.resources.map(&:tableize)).uniq
end
Expand Down
9 changes: 9 additions & 0 deletions test/controllers/bookmarks_controller_test.rb
Expand Up @@ -75,4 +75,13 @@ class BookmarksControllerTest < ActionController::TestCase
refute_empty assigns(:bookmarks)
assert assigns(:bookmarks).include?(bookmarks(:one))
end

test "should create bookmark for global parameter" do
User.current = users(:one)
assert_difference('Bookmark.count') do
post :create, { :bookmark => { :name => "foo-bar", :query => "bar", :public => false, :controller => "common_parameters" } }, set_session_user
end

assert_redirected_to common_parameters_path
end
end