Class: FileSandbox::HaveContents

Inherits:
Object
  • Object
show all
Defined in:
spec_help/file-sandbox.rb

Instance Method Summary (collapse)

Constructor Details

- (HaveContents) initialize(contents)

A new instance of HaveContents



18
19
20
# File 'spec_help/file-sandbox.rb', line 18

def initialize(contents)
  @contents = contents
end

Instance Method Details

- (Boolean) matches?(target)

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
# File 'spec_help/file-sandbox.rb', line 22

def matches?(target)
  case @contents
  when Regexp
	@contents =~ target.contents
  when String
	@contents == target.contents
  end
end