Class: RSpec::RailsApp::ArtifactFile::Matchers::HaveRailsArtifactFile
- Inherits:
-
Object
- Object
- RSpec::RailsApp::ArtifactFile::Matchers::HaveRailsArtifactFile
- Extended by:
- RailsAssist::UseMacro
- Includes:
- ArtifactFile::Matcher::Helper
- Defined in:
- lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#artifact_name ⇒ Object
Returns the value of attribute artifact_name.
-
#artifact_type ⇒ Object
Returns the value of attribute artifact_type.
-
#folder ⇒ Object
Returns the value of attribute folder.
-
#name ⇒ Object
Returns the value of attribute name.
-
#view_ext ⇒ Object
Returns the value of attribute view_ext.
Attributes included from ArtifactFile::Matcher::Helper
Instance Method Summary collapse
-
#initialize(name, artifact_type = nil) ⇒ HaveRailsArtifactFile
constructor
A new instance of HaveRailsArtifactFile.
- #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(name, artifact_type = nil) ⇒ HaveRailsArtifactFile
Returns a new instance of HaveRailsArtifactFile.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb', line 12 def initialize(name, artifact_type = nil) self.artifact_type = artifact_type extend "RailsAssist::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 |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
8 9 10 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb', line 8 def action @action end |
#artifact_name ⇒ Object
Returns the value of attribute artifact_name.
7 8 9 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb', line 7 def artifact_name @artifact_name end |
#artifact_type ⇒ Object
Returns the value of attribute artifact_type.
7 8 9 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb', line 7 def artifact_type @artifact_type end |
#folder ⇒ Object
Returns the value of attribute folder.
8 9 10 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb', line 8 def folder @folder end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb', line 7 def name @name end |
#view_ext ⇒ Object
Returns the value of attribute view_ext.
8 9 10 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb', line 8 def view_ext @view_ext end |
Instance Method Details
#matches?(root_path, &block) ⇒ Boolean
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rails_app_spec/matchers/artifact/have_rails_artifact_file.rb', line 24 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 |