Sha256: 2a7fbc8645252f7fb00c33aa4111ae2229614aa84b83ed39cee50229d6ca7b69

Contents?: true

Size: 805 Bytes

Versions: 3

Compression:

Stored size: 805 Bytes

Contents

module RSpec::RailsApp::Artifact
  module Matchers
    class GenerateArtifacts < HaveArtifacts
      def initialize(artifact_type, *names)
        super
      end
      
      def matches?(generator, &block)            
        root = Rails.root # File.join(Rails.application.config.root_dir, 'rails_app'), &block
        super root
      end 
    end    
    
    def generate_artifacts type, *names
      GenerateArtifacts.new type, *names
    end
    
    (::RailsAssist.artifacts - [:view]).each do |name|
      plural_artifact = name.to_s.pluralize
      class_eval %{
        def generate_#{plural_artifact} *names
          generate_artifacts :#{name}, *names 
        end
      }
    end  
    
    def generate_views folder, *args
      generate_artifacts folder, *args
    end
  end
end       

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
generator-spec-0.7.8 lib/generator-spec/rspec/matchers/generate_artifacts.rb
generator-spec-0.7.6 lib/generator-spec/rspec/matchers/generate_artifacts.rb
generator-spec-0.7.5 lib/generator-spec/rspec/matchers/generate_artifacts.rb