Sha256: c7bd444c3956dedc4e8bf3b99665ca91c5f8b029098de3a791b35ed22d46d043

Contents?: true

Size: 1.06 KB

Versions: 51

Compression:

Stored size: 1.06 KB

Contents

require "test_helper"

module Admin
  class PartsControllerTest < ActionController::TestCase
    fixtures :all

    def setup
      @toy_category = categories(:toys).to_param
      @lego_widget = widgets(:one).to_param
      @some_part = parts(:one).to_param
    end

    test "should get show" do
      get :show, category_id: @toy_category, widget_id: @lego_widget, id: @some_part
      assert_response :success
    end

    test "should display the nested index" do
      response = get :index, category_id: @toy_category, widget_id: @lego_widget
      assert_response :success
      assert_match /Some part/, response.body
      refute_match /Another part/, response.body
    end

    test "nested resources should build from parent resource" do
      post :create, category_id: @toy_category, widget_id: @lego_widget, part: {name: 'Yellow'}

      response = get :index, category_id: @toy_category, widget_id: @lego_widget
      assert_match /Some part/, response.body
      assert_match /Yellow/, response.body
      refute_match /Another part/, response.body
    end

  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
express_admin-2.0.0.b test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-2.0.0.a test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.8.1 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.8.0 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.32 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.31 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.30 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.29 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.28 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.27 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.26 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.25 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.24 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.23 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.22 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.21 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.20 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.19 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.18 test/dummy/test/controllers/admin/parts_controller_test.rb
express_admin-1.7.17 test/dummy/test/controllers/admin/parts_controller_test.rb