Sha256: d945a367337de5fd2b59897861154aea5fee6204d07c6251895e50efea9c3898

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

require_relative 'base_helpers'
require_relative '../../tests/command_runner'

module AcceptanceTests
  module CommandHelpers
    include BaseHelpers
    extend RSpec::Matchers::DSL

    def run_command(*args)
      Tests::CommandRunner.run(*args) do |runner|
        runner.directory = fs.project_directory
        yield runner if block_given?
      end
    end

    def run_command!(*args)
      run_command(*args) do |runner|
        runner.run_successfully = true
        yield runner if block_given?
      end
    end

    def run_command_within_bundle(*args)
      run_command(*args) do |runner|
        runner.command_prefix = 'bundle exec'
        runner.env['BUNDLE_GEMFILE'] = fs.find_in_project('Gemfile').to_s

        runner.around_command do |run_command|
          Bundler.with_clean_env(&run_command)
        end

        yield runner if block_given?
      end
    end

    def run_command_within_bundle!(*args)
      run_command_within_bundle(*args) do |runner|
        runner.run_successfully = true
        yield runner if block_given?
      end
    end

    def run_rake_tasks(*tasks)
      run_command_within_bundle('rake', *tasks)
    end

    def run_rake_tasks!(*tasks)
      run_command_within_bundle!('rake', *tasks)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-matchers-2.8.0/spec/support/acceptance/helpers/command_helpers.rb
shoulda-matchers-2.8.0 spec/support/acceptance/helpers/command_helpers.rb
shoulda-matchers-2.8.0.rc2 spec/support/acceptance/helpers/command_helpers.rb
shoulda-matchers-2.8.0.rc1 spec/support/acceptance/helpers/command_helpers.rb