Class: Templater::Spec::Helpers::InvokeMatcher

### Home Classes Methods

### In Files

- lib/templater/spec/helpers.rb

### Parent

Object

### Methods

- ::new
- #failure_message
- #matches?
- #negative_failure_message
- #with

### Files

- History.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Templater
- Templater::ActionDescription
- Templater::Actions
- Templater::Actions::Action
- Templater::Actions::Directory
- Templater::Actions::EmptyDirectory
- Templater::Actions::File
- Templater::Actions::Template
- Templater::ArgumentDescription
- Templater::CLI
- Templater::CLI::Generator
- Templater::CLI::Manifold
- Templater::Description
- Templater::Discovery
- Templater::Generator
- Templater::InvocationDescription
- Templater::Manifold
- Templater::Spec
- Templater::Spec::Helpers
- Templater::Spec::Helpers::CreateMatcher
- Templater::Spec::Helpers::InvokeMatcher
- Kernel
- String

No matching classes.

# Templater::Spec::Helpers::InvokeMatcher

### Public Class Methods

new(expected) click to toggle source

    # File lib/templater/spec/helpers.rb, line 6
    def initialize(expected)
      @expected = expected
    end

### Public Instance Methods

failure_message() click to toggle source

    # File lib/templater/spec/helpers.rb, line 28
    def failure_message
      "expected #{@actual.inspect} to invoke #{@expected.inspect} with #{@with}, but it didn't"
    end

matches?(actual) click to toggle source

    # File lib/templater/spec/helpers.rb, line 10
    def matches?(actual)
      @actual = actual
      # Satisfy expectation here. Return false or raise an error if it's not met.
      found = nil
      @actual.invocations.each { |i| found = i if i.class == @expected }

      if @with
        return found && (@with == found.arguments)
      else
        return found
      end
    end

negative_failure_message() click to toggle source

    # File lib/templater/spec/helpers.rb, line 32
    def negative_failure_message
      "expected #{@actual.inspect} not to invoke #{@expected.inspect} with #{@with}, but it did"
    end

with(*arguments) click to toggle source

    # File lib/templater/spec/helpers.rb, line 23
    def with(*arguments)
      @with = arguments
      return self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.