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.11.18 spec/support/aruba.rb
fedux_org-stdlib-0.11.17 spec/support/aruba.rb
fedux_org-stdlib-0.11.16 spec/support/aruba.rb
fedux_org-stdlib-0.11.15 spec/support/aruba.rb
fedux_org-stdlib-0.11.14 spec/support/aruba.rb
fedux_org-stdlib-0.11.12 spec/support/aruba.rb
fedux_org-stdlib-0.11.11 spec/support/aruba.rb
fedux_org-stdlib-0.11.9 spec/support/aruba.rb
fedux_org-stdlib-0.11.8 spec/support/aruba.rb
fedux_org-stdlib-0.11.7 spec/support/aruba.rb
fedux_org-stdlib-0.11.6 spec/support/aruba.rb
fedux_org-stdlib-0.11.5 spec/support/aruba.rb
fedux_org-stdlib-0.11.4 spec/support/aruba.rb
fedux_org-stdlib-0.11.3 spec/support/aruba.rb
fedux_org-stdlib-0.11.2 spec/support/aruba.rb
fedux_org-stdlib-0.11.1 spec/support/aruba.rb
fedux_org-stdlib-0.11.0 spec/support/aruba.rb
fedux_org-stdlib-0.10.9 spec/support/aruba.rb
fedux_org-stdlib-0.10.8 spec/support/aruba.rb
fedux_org-stdlib-0.10.7 spec/support/aruba.rb