Created
June 1, 2015 08:52
-
-
Save mipmip/7fcd58789ea9ff7f7a83 to your computer and use it in GitHub Desktop.
Integration test for checking custom actions in rails_admin implementation
This file contains hidden or 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
require 'test_helper' | |
class RailsadminFlowsTest < ActionDispatch::IntegrationTest | |
include Warden::Test::Helpers | |
test "login as admin" do | |
login_as_admin | |
get "/admin" | |
assert_response :success | |
end | |
test "magic asset admin functions" do | |
login_as_admin | |
magic_asset = magic_assets(:magic_assets_001) | |
get "/admin/magic_asset/#{magic_asset.id}" | |
assert_response :success | |
get "/admin/magic_asset/#{magic_asset.id}/edit" | |
assert_response :success | |
get "/admin/magic_asset/#{magic_asset.id}/refxmanindex" | |
assert_response :redirect | |
assert_equal 'translation missing: en.restarted_refx_index_job', flash[:success] | |
end | |
test "event_handler admin functions" do | |
login_as_admin | |
event_handler = event_handlers(:event_handlers_001) | |
get "/admin/event_handler/#{event_handler.id}" | |
assert_response :success | |
get "/admin/event_handler/#{event_handler.id}/edit" | |
assert_response :success | |
get "/admin/event_handler/#{event_handler.id}/configurehandler" | |
assert_response :success | |
post_via_redirect "/admin/event_handler/#{event_handler.id}/configurehandler" | |
assert_response :success | |
end | |
test "work admin functions" do | |
login_as_admin | |
work = works(:works_001) | |
get "/admin/work/#{work.id}" | |
assert_response :success | |
get "/admin/work/#{work.id}/edit" | |
assert_response :success | |
end | |
private | |
def login_as_admin | |
Warden.test_mode! | |
user = users(:users_001) | |
login_as(user, :scope => :user) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment