Sha256: 2bc45b7e6e4218f1c22948c3cf3493539d3ccb5634494dc1f927afaab4345e09

Contents?: true

Size: 760 Bytes

Versions: 10

Compression:

Stored size: 760 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::RSpec.install_tasks

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hexx-rspec-0.4.2 spec/support/tasks.rb
hexx-rspec-0.4.1 spec/support/tasks.rb
hexx-rspec-0.4.0 spec/support/tasks.rb
hexx-rspec-0.3.1 spec/support/tasks.rb
hexx-rspec-0.3.0 spec/support/tasks.rb
hexx-rspec-0.2.2 spec/support/tasks.rb
hexx-rspec-0.2.1 spec/support/tasks.rb
hexx-rspec-0.2.0 spec/support/config/tasks.rb
hexx-rspec-0.1.0 spec/support/config/tasks.rb
hexx-rspec-0.0.1 spec/support/config/tasks.rb