Sha256: d8083f067aa9928ad3f8bef2a731ea094d6e196d377700e7b8f3b2ce43558fa1

Contents?: true

Size: 831 Bytes

Versions: 9

Compression:

Stored size: 831 Bytes

Contents

module RSpec         
  module Generators
    class TestCase < ::Rails::Generators::TestCase   
      setup :prepare_destination
      # setup :copy_routes
      
            
      def initialize(test_method_name)
        @method_name = test_method_name
        @test_passed = true
        @interrupted = false
        routes_file = File.join(File.dirname(__FILE__), 'fixtures', 'routes.rb')        
        copy_routes routes_file
      end 
      
      def copy_routes routes_file        
        routes = File.expand_path(routes_file)
        raise ArgumentError, "No routes file exists at #{routes_file}" if !File.exist?(routes)
        destination = File.join(::Rails.root, "config")
        FileUtils.mkdir_p(destination) # create dir
        FileUtils.cp routes, destination # copy
      end
           
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
generator-spec-0.4.3 lib/rspec_for_generators/rspec_test_case.rb
generator-spec-0.4.2 lib/rspec_for_generators/rspec_test_case.rb
generator-spec-0.4.1 lib/rspec_for_generators/rspec_test_case.rb
generator-spec-0.4.0 lib/rspec_for_generators/rspec_test_case.rb
generator-spec-0.3.5 lib/rspec_for_generators/rspec_test_case.rb
generator-spec-0.3.4 lib/rspec_for_generators/rspec_test_case.rb
generator-spec-0.3.3 lib/rspec_for_generators/rspec_test_case.rb
rspec_for_generators-0.3.1 lib/rspec_for_generators/rspec_test_case.rb
rspec_for_generators-0.3.0 lib/rspec_for_generators/rspec_test_case.rb