4 class UserBlocksControllerTest < ActionDispatch::IntegrationTest
7 { :path => "/api/0.6/user_blocks/1", :method => :get },
8 { :controller => "api/user_blocks", :action => "show", :id => "1" }
11 { :path => "/api/0.6/user_blocks/1.json", :method => :get },
12 { :controller => "api/user_blocks", :action => "show", :id => "1", :format => "json" }
17 block = create(:user_block)
19 get api_user_block_path(:id => block)
20 assert_response :success
21 assert_select "user_block[id='#{block.id}']", 1
23 get api_user_block_path(:id => block, :format => "json")
24 assert_response :success
25 js = ActiveSupport::JSON.decode(@response.body)
27 assert_equal block.id, js["user_block"]["id"]
30 def test_show_not_found
31 get api_user_block_path(:id => 123)
32 assert_response :not_found
33 assert_equal "text/plain", @response.media_type