Sha256: b13afea0640fdb7d5e60fef1592b9fedb8f4a4716912904c931604cd9afe42f1

Contents?: true

Size: 1.01 KB

Versions: 38

Compression:

Stored size: 1.01 KB

Contents

# encoding: utf-8
require 'aruba/api'
require 'aruba/reporting'

module FeduxOrgStdlib
  # Spec Helpers
  module SpecHelper
    # Helpers for aruba
    module Aruba
      include ::Aruba::Api

      def dirs
        @dirs ||= %w(tmp rspec)
      end

      def absolute_path(*args)
        in_current_dir { File.expand_path File.join(*args) }
      end

      def _create_file(*args)
        super

        args.first
      end

      def create_dir(*args)
        super

        args.first
      end

      def touch_file(file_name)
        in_current_dir do
          file_name = File.expand_path(file_name)
          _mkdir(File.dirname(file_name))
          FileUtils.touch file_name
        end

        file_name
      end
    end
  end
end

RSpec.configure do |c|
  c.include FeduxOrgStdlib::SpecHelper::Aruba

  c.before :each do
    clean_current_dir
  end

  c.around(:example) do |example|
    old_env = ENV.to_h

    with_env 'HOME' => absolute_path('.') do
      example.run
    end

    ENV.replace old_env
  end

end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.10.6 spec/support/aruba.rb
fedux_org-stdlib-0.10.5 spec/support/aruba.rb
fedux_org-stdlib-0.10.4 spec/support/aruba.rb
fedux_org-stdlib-0.10.3 spec/support/aruba.rb
fedux_org-stdlib-0.10.2 spec/support/aruba.rb
fedux_org-stdlib-0.10.1 spec/support/aruba.rb
fedux_org-stdlib-0.10.0 spec/support/aruba.rb
fedux_org-stdlib-0.9.8 spec/support/aruba.rb
fedux_org-stdlib-0.9.7 spec/support/aruba.rb
fedux_org-stdlib-0.9.6 spec/support/aruba.rb
fedux_org-stdlib-0.9.5 spec/support/aruba.rb
fedux_org-stdlib-0.9.4 spec/support/aruba.rb
fedux_org-stdlib-0.9.2 spec/support/aruba.rb
fedux_org-stdlib-0.9.1 spec/support/aruba.rb
fedux_org-stdlib-0.9.0 spec/support/aruba.rb
fedux_org-stdlib-0.8.11 spec/support/aruba.rb
fedux_org-stdlib-0.8.10 spec/support/aruba.rb
fedux_org-stdlib-0.8.9 spec/support/aruba.rb