Class: RSpec::RailsApp::File::Matchers::HaveRailsFiles
- Inherits:
-
Object
- Object
- RSpec::RailsApp::File::Matchers::HaveRailsFiles
- Includes:
- RailsAssist::Artifact, RailsAssist::File, RailsFile::Matcher::Helper
- Defined in:
- lib/rails_app_spec/matchers/file/have_rails_files.rb
Instance Attribute Summary collapse
-
#names ⇒ Object
readonly
Returns the value of attribute names.
Attributes included from RailsFile::Matcher::Helper
Instance Method Summary collapse
-
#initialize(type, *names) ⇒ HaveRailsFiles
constructor
A new instance of HaveRailsFiles.
- #matches?(obj, &block) ⇒ Boolean
Methods included from RailsFile::Matcher::Helper
#failure_message, #msg, #negative_failure_message
Constructor Details
#initialize(type, *names) ⇒ HaveRailsFiles
Returns a new instance of HaveRailsFiles.
12 13 14 15 |
# File 'lib/rails_app_spec/matchers/file/have_rails_files.rb', line 12 def initialize(type, *names) @type = type @names = names end |
Instance Attribute Details
#names ⇒ Object (readonly)
Returns the value of attribute names.
10 11 12 |
# File 'lib/rails_app_spec/matchers/file/have_rails_files.rb', line 10 def names @names end |
Instance Method Details
#matches?(obj, &block) ⇒ Boolean
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rails_app_spec/matchers/file/have_rails_files.rb', line 17 def matches?(obj, &block) begin labels = names.to_strings return false if labels.empty? labels.each do |name| @name = name @file = send(:"#{type}_file", name) return false if !File.file?(file) end yield if block true rescue false end end |