]> git.openstreetmap.org Git - rails.git/blob - test/controllers/api/user_blocks_controller_test.rb
eef54e931dc1404ace1f39020c98eda0b2b1e9a3
[rails.git] / test / controllers / api / user_blocks_controller_test.rb
1 require "test_helper"
2
3 module Api
4   class UserBlocksControllerTest < ActionDispatch::IntegrationTest
5     def test_routes
6       assert_routing(
7         { :path => "/api/0.6/user_blocks/1", :method => :get },
8         { :controller => "api/user_blocks", :action => "show", :id => "1" }
9       )
10     end
11
12     def test_show
13       block = create(:user_block)
14
15       get api_user_block_path(:id => block)
16       assert_response :success
17       assert_select "user_block[id='#{block.id}']", 1
18     end
19
20     def test_show_not_found
21       get api_user_block_path(:id => 123)
22       assert_response :not_found
23       assert_equal "text/plain", @response.media_type
24     end
25   end
26 end