Sha256: bc42a50e2a23c293b8b20604bfec56c3b005b0874a2f4c575eafe6c42ca97408
Contents?: true
Size: 958 Bytes
Versions: 4
Compression:
Stored size: 958 Bytes
Contents
require File.expand_path('../../../../test_helper', __FILE__) 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 singular" do run_generator ["posts"] 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
4 entries across 4 versions & 1 rubygems