module RSpec::RailsApp::Artifact module Matchers class GenerateArtifact < HaveArtifact def initialize(name, artifact_type) super end def matches?(generator, &block) super File.join(Rails.application.config.root_dir, 'rails_app'), &block end end def generate_artifact name, type GenerateArtifact.new name, type end (::Rails3::Assist.artifacts - [:view]).each do |name| plural_artifact = name.to_s.pluralize class_eval %{ def generate_#{name} name generate_artifact name, :#{name} end alias_method :create_#{name}, :generate_#{name} } end def generate_view folder, action=nil, view_ext=nil arg = {:folder => folder, :action => action, :view_ext => view_ext} generate_artifact arg, :view end alias_method :create_view, :generate_view end end