Sha256: 5ee62cde2df9de4349bef45be85b4d2f2f017a9d9eed0e6855765e129293a8ab
Contents?: true
Size: 1.88 KB
Versions: 9
Compression:
Stored size: 1.88 KB
Contents
module ArtifactFile module Matcher end end module ArtifactFile::Matcher module Helper include ::Rails3::Assist::Artifact::View::FileName attr_reader :name, :artifact_type, :artifact_name attr_reader :folder, :action, :view_ext attr_reader :names, :root_path def set_view name view_options = name @folder = view_options[:folder] @action = view_options[:action] @view_ext = view_options[:view_ext] @artifact_type = :view end def handle_view artifact_type, names if artifact_type == :view lang_option = last_arg({:lang => 'erb.html'}, names) raise ArgumentException, ':folder option must be specified in the last hash argument for #have_views' if !lang_option[:folder] @folder = lang_option[:folder] @view_ext = get_view_ext(lang_option[:lang] || :erb) end end def get_view_ext(ext) case ext.to_sym when :erb 'erb.html' when :haml 'haml.html' else ext.to_s end end def get_artifact_name case artifact_type when :view path = send(:view_file_name, folder, artifact_name) #, view_ext, :root_path => root_path) else find_existing_artifact_method = "existing_#{artifact_type}_file" if respond_to? find_existing_artifact_method send find_existing_artifact_method, artifact_name, artifact_type, :root_path => root_path else raise "The method ##{find_existing_artifact_method} to find the artifact was not available" end end end def msg "the #{artifact_type} #{artifact_name} to exist" end def failure_message "Expected #{msg}" end def negative_failure_message "Did not expect #{msg}" end end end
Version data entries
9 entries across 9 versions & 1 rubygems