Sha256: 22e6c9037e8dfc232f63b8e13188833bb88f0322854a8a5770955eb552a7c92a
Contents?: true
Size: 1.87 KB
Versions: 3
Compression:
Stored size: 1.87 KB
Contents
module ArtifactFile module Matcher end end module ArtifactFile::Matcher module Helper include ::RailsAssist::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
3 entries across 3 versions & 1 rubygems