Class: RSpec::RailsApp::ArtifactFile::Matchers::HaveRailsArtifactFiles
- Inherits:
-
Object
- Object
- RSpec::RailsApp::ArtifactFile::Matchers::HaveRailsArtifactFiles
- Extended by:
- RailsAssist::UseMacro
- Includes:
- ArtifactFile::Matcher::Helper
- Defined in:
- lib/rails_app_spec/matchers/artifact/have_rails_artifact_files.rb
Instance Attribute Summary
Attributes included from ArtifactFile::Matcher::Helper
#action, #artifact_name, #artifact_type, #folder, #name, #names, #root_path, #view_ext
Instance Method Summary collapse
-
#initialize(artifact_type, *names) ⇒ HaveRailsArtifactFiles
constructor
A new instance of HaveRailsArtifactFiles.
- #matches?(root_path, &block) ⇒ Boolean
Methods included from ArtifactFile::Matcher::Helper
#failure_message, #get_artifact_name, #get_view_ext, #handle_view, #msg, #negative_failure_message, #set_view
Constructor Details
#initialize(artifact_type, *names) ⇒ HaveRailsArtifactFiles
Returns a new instance of HaveRailsArtifactFiles.
9 10 11 12 13 14 15 16 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_files.rb', line 9 def initialize(artifact_type, *names) @names = names extend "RailsAssist::Artifact::#{artifact_type.to_s.camelize}".constantize handle_view artifact_type, names @artifact_type = artifact_type end |
Instance Method Details
#matches?(root_path, &block) ⇒ Boolean
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_files.rb', line 18 def matches?(root_path, &block) labels = names.to_strings return false if labels.empty? begin labels.each do |name| @artifact_name = name @artifact_name = get_artifact_name return false if !File.file?(artifact_name) end yield if block true rescue false end end |