Class: RSpec::RailsApp::File::Matchers::HaveRailsFile
- Inherits:
-
Object
- Object
- RSpec::RailsApp::File::Matchers::HaveRailsFile
- Includes:
- RailsAssist::Artifact, RailsAssist::File, RailsFile::Matcher::Helper
- Defined in:
- lib/rails_app_spec/matchers/file/have_rails_file.rb
Instance Attribute Summary
Attributes included from RailsFile::Matcher::Helper
Instance Method Summary collapse
-
#initialize(name, type = nil) ⇒ HaveRailsFile
constructor
A new instance of HaveRailsFile.
- #matches?(obj, &block) ⇒ Boolean
Methods included from RailsFile::Matcher::Helper
#failure_message, #msg, #negative_failure_message
Constructor Details
#initialize(name, type = nil) ⇒ HaveRailsFile
Returns a new instance of HaveRailsFile.
10 11 12 13 |
# File 'lib/rails_app_spec/matchers/file/have_rails_file.rb', line 10 def initialize(name, type = nil) @type = type if type @name = name end |
Instance Method Details
#matches?(obj, &block) ⇒ Boolean
15 16 17 18 19 20 21 22 |
# File 'lib/rails_app_spec/matchers/file/have_rails_file.rb', line 15 def matches?(obj, &block) begin @file = type ? send(:"#{type}_file", name) : send(:"#{name}_file") File.file? file rescue false end end |