Sha256: 1ea52cfff02f0a0708812a716a6ad95defd5c5b67fecafbd178f9bb6edbdb581

Contents?: true

Size: 765 Bytes

Versions: 5

Compression:

Stored size: 765 Bytes

Contents

# encoding: utf-8

RSpec.configure do |config|

  # Array of commands that was sent to system
  #
  # @return [Array<String>]
  def commands
    @commands ||= []
  end

  # Checks whether a task with given name has been invoked
  #
  # @param [String] name
  #
  # @return [Boolean]
  def task_invoked?(name)
    Rake::Task[name].instance_eval { @already_invoked }
  end

  config.before :example, :tasks do

    # Resets Rake application and reinstalls all tasks to be available
    Rake.application = nil
    Hexx::Suit.install_tasks

    # Captures commands that System utility sends to system
    # and stores them in {#commands} array.
    allow_any_instance_of(Hexx::Suit::Utils::System)
      .to receive(:system) { |command| commands << command }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hexx-suit-0.2.2 spec/support/config/tasks.rb
hexx-suit-0.2.1 spec/support/config/tasks.rb
hexx-suit-0.2.0 spec/support/config/tasks.rb
hexx-suit-0.1.0 spec/support/config/tasks.rb
hexx-suit-0.0.1 spec/support/config/tasks.rb