Sha256: 342b5d81518a117448515d43fe13671f19a23987a0b9e99169580fafbaa52609

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 Bytes

Contents

require 'test_helper'
require 'generators/jsonapi/resource_generator'

module Jsonapi
  class ResourceGeneratorTest < Rails::Generators::TestCase
    tests ResourceGenerator
    destination Rails.root.join('../resources')
    setup :prepare_destination
    teardown :cleanup_destination_root

    def cleanup_destination_root
      FileUtils.rm_rf destination_root
    end

    test "resource is created" do
      run_generator ["post"]
      assert_file 'app/resources/post_resource.rb', /class PostResource < JSONAPI::Resource/
    end

    test "resource is created with namespace" do
      run_generator ["api/v1/post"]
      assert_file 'app/resources/api/v1/post_resource.rb', /class Api::V1::PostResource < JSONAPI::Resource/
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jsonapi-resources-0.5.7 test/lib/generators/jsonapi/resource_generator_test.rb
jsonapi-resources-0.5.6 test/lib/generators/jsonapi/resource_generator_test.rb
jsonapi-resources-0.5.5 test/lib/generators/jsonapi/resource_generator_test.rb