Class: RSpec::RailsApp::Dir::Matchers::HaveRailsDir

Inherits:
Object
  • Object
show all
Includes:
Rails::Assist::App
Defined in:
lib/rails_app_spec/matchers/file/have_rails_dir.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type = nil) ⇒ HaveRailsDir

Returns a new instance of HaveRailsDir.



8
9
10
# File 'lib/rails_app_spec/matchers/file/have_rails_dir.rb', line 8

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

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



6
7
8
# File 'lib/rails_app_spec/matchers/file/have_rails_dir.rb', line 6

def dir
  @dir
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/rails_app_spec/matchers/file/have_rails_dir.rb', line 6

def type
  @type
end

Instance Method Details

#failure_messageObject



17
18
19
# File 'lib/rails_app_spec/matchers/file/have_rails_dir.rb', line 17

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

#matches?(obj, &block) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/rails_app_spec/matchers/file/have_rails_dir.rb', line 12

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

#negative_failure_messageObject



21
22
23
# File 'lib/rails_app_spec/matchers/file/have_rails_dir.rb', line 21

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