Sha256: e2699afe062c204fb63a54cfce1815771a659cc36e8a0d5aa963506d4be33722
Contents?: true
Size: 1.18 KB
Versions: 7
Compression:
Stored size: 1.18 KB
Contents
module RSpec::RailsApp::ArtifactFile module Matchers class HaveRailsArtifactFile extend Rails3::Assist::UseMacro use_helpers :file attr_accessor :name, :artifact_type, :artifact_name attr_accessor :folder, :action, :view_ext include ::ArtifactFile::Matcher::Helper def initialize(name, artifact_type = nil) self.artifact_type = artifact_type extend "Rails3::Assist::Artifact::#{artifact_type.to_s.camelize}".constantize if name.kind_of? Hash set_view name return nil end self.artifact_name = name.to_s end def matches?(root_path, &block) begin self.artifact_name = get_artifact_name match = File.file? artifact_name if block && match yield File.read(artifact_name) end match rescue false end end end def have_rails_artifact_file(relative, artifact_type = nil) HaveRailsArtifactFile.new(relative, artifact_type) end alias_method :contain_rails_artifact_file, :have_rails_artifact_file end end
Version data entries
7 entries across 7 versions & 1 rubygems