Class: RSpec::RailsApp::Directory::Matchers::HaveRailsDirs
- Inherits:
-
Object
- Object
- RSpec::RailsApp::Directory::Matchers::HaveRailsDirs
- Extended by:
- RailsAssist::UseMacro
- Defined in:
- lib/rails_app_spec/matchers/directory/have_rails_dirs.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#dir_name ⇒ Object
Returns the value of attribute dir_name.
-
#dirs ⇒ Object
Returns the value of attribute dirs.
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(*dirs) ⇒ HaveRailsDirs
constructor
A new instance of HaveRailsDirs.
- #matches?(obj, &block) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(*dirs) ⇒ HaveRailsDirs
Returns a new instance of HaveRailsDirs.
9 10 11 |
# File 'lib/rails_app_spec/matchers/directory/have_rails_dirs.rb', line 9 def initialize *dirs @dirs = dirs end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
7 8 9 |
# File 'lib/rails_app_spec/matchers/directory/have_rails_dirs.rb', line 7 def dir @dir end |
#dir_name ⇒ Object
Returns the value of attribute dir_name.
7 8 9 |
# File 'lib/rails_app_spec/matchers/directory/have_rails_dirs.rb', line 7 def dir_name @dir_name end |
#dirs ⇒ Object
Returns the value of attribute dirs.
7 8 9 |
# File 'lib/rails_app_spec/matchers/directory/have_rails_dirs.rb', line 7 def dirs @dirs end |
Instance Method Details
#failure_message ⇒ Object
25 26 27 |
# File 'lib/rails_app_spec/matchers/directory/have_rails_dirs.rb', line 25 def "Expected Rails app to have dir: #{dir_name}, but it didn't" end |
#matches?(obj, &block) ⇒ Boolean
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rails_app_spec/matchers/directory/have_rails_dirs.rb', line 13 def matches?(obj, &block) labels = dirs.to_strings return false if labels.empty? labels.each do |dir_name| @dir_name = dir_name @dir = send :"#{dir_name}_dir" return false if !File.directory?(dir) end yield if block true end |
#negative_failure_message ⇒ Object
29 30 31 |
# File 'lib/rails_app_spec/matchers/directory/have_rails_dirs.rb', line 29 def "Did not expected Rails app to have dir: #{dir_name}, but it did" end |