Module: ArtifactFile::Matcher::Helper
- Includes:
- RailsAssist::Artifact::View::FileName
- Included in:
- RSpec::RailsApp::Artifact::Matchers::HaveArtifacts, RSpec::RailsApp::ArtifactFile::Matchers::HaveRailsArtifactFile, RSpec::RailsApp::ArtifactFile::Matchers::HaveRailsArtifactFiles
- Defined in:
- lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#artifact_name ⇒ Object
readonly
Returns the value of attribute artifact_name.
-
#artifact_type ⇒ Object
readonly
Returns the value of attribute artifact_type.
-
#folder ⇒ Object
readonly
Returns the value of attribute folder.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#names ⇒ Object
readonly
Returns the value of attribute names.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
-
#view_ext ⇒ Object
readonly
Returns the value of attribute view_ext.
Instance Method Summary collapse
- #failure_message ⇒ Object
- #get_artifact_name ⇒ Object
- #get_view_ext(ext) ⇒ Object
- #handle_view(artifact_type, names) ⇒ Object
- #msg ⇒ Object
- #negative_failure_message ⇒ Object
- #set_view(name) ⇒ Object
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
11 12 13 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 11 def action @action end |
#artifact_name ⇒ Object (readonly)
Returns the value of attribute artifact_name.
10 11 12 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 10 def artifact_name @artifact_name end |
#artifact_type ⇒ Object (readonly)
Returns the value of attribute artifact_type.
10 11 12 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 10 def artifact_type @artifact_type end |
#folder ⇒ Object (readonly)
Returns the value of attribute folder.
11 12 13 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 11 def folder @folder end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 10 def name @name end |
#names ⇒ Object (readonly)
Returns the value of attribute names.
12 13 14 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 12 def names @names end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
12 13 14 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 12 def root_path @root_path end |
#view_ext ⇒ Object (readonly)
Returns the value of attribute view_ext.
11 12 13 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 11 def view_ext @view_ext end |
Instance Method Details
#failure_message ⇒ Object
60 61 62 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 60 def "Expected #{msg}" end |
#get_artifact_name ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 42 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 |
#get_view_ext(ext) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 31 def get_view_ext(ext) case ext.to_sym when :erb 'erb.html' when :haml 'haml.html' else ext.to_s end end |
#handle_view(artifact_type, names) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 22 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 |
#msg ⇒ Object
56 57 58 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 56 def msg "the #{artifact_type} #{artifact_name} to exist" end |
#negative_failure_message ⇒ Object
64 65 66 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 64 def "Did not expect #{msg}" end |
#set_view(name) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/rails_app_spec/matchers/artifact/shared/artifact_file_helper.rb', line 14 def set_view name = name @folder = [:folder] @action = [:action] @view_ext = [:view_ext] @artifact_type = :view end |