Class: RSpec::RailsApp::Directory::Matchers::HaveRailsDir

Inherits:
Object
  • Object
show all
Extended by:
RailsAssist::UseMacro
Defined in:
lib/rails_app_spec/matchers/directory/have_rails_dir.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = nil) ⇒ HaveRailsDir

Returns a new instance of HaveRailsDir.



9
10
11
# File 'lib/rails_app_spec/matchers/directory/have_rails_dir.rb', line 9

def initialize(type = nil)
  @type = type
end

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



7
8
9
# File 'lib/rails_app_spec/matchers/directory/have_rails_dir.rb', line 7

def dir
  @dir
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/rails_app_spec/matchers/directory/have_rails_dir.rb', line 7

def type
  @type
end

Instance Method Details

#failure_messageObject



18
19
20
# File 'lib/rails_app_spec/matchers/directory/have_rails_dir.rb', line 18

def failure_message
  "Expected Rails app to have dir: #{relative_path}, but it didn't"
end

#matches?(obj, &block) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/rails_app_spec/matchers/directory/have_rails_dir.rb', line 13

def matches?(obj, &block)
  @dir = send :"#{type}_dir"
  File.directory? dir
end

#negative_failure_messageObject



22
23
24
# File 'lib/rails_app_spec/matchers/directory/have_rails_dir.rb', line 22

def negative_failure_message
  "Did not expected Rails app to have dir: #{relative_path}, but it did"
end