Sha256: 510e9396b0f1bdb73171c75ba5ccced094dd59975a9f7230b9f1ff75cc8df143

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

require 'codeclimate-test-reporter'
require 'warp/dir'
require 'rspec/core'

CodeClimate::TestReporter.start

module Warp
  module Dir
    module App
      class Response
        class << self
          attr_accessor :exit_disabled

          def enable_exit!
            self.exit_disabled = false
          end

          def disable_exit!
            self.exit_disabled = true
          end

          def exit_disabled?
            self.exit_disabled
          end
        end
      end
    end
  end
end

RSpec.configure do |config|
  config.before do
    Warp::Dir::App::Response.disable_exit!
    srand 117
  end
end

RSpec.shared_context :fake_serializer do
  let(:file) { @file ||= ::Tempfile.new('warp-dir') }
  let(:config) { Warp::Dir::Config.new(warprc: file.path) }
  let(:serializer) {
    @initialized_store ||= FakeSerializer ||= Class.new(Warp::Dir::Serializer::Base) do
      def persist!;
      end

      def restore!;
      end
    end
  }

  after do
    file.close
    file.unlink
  end
end

RSpec.shared_context :fixture_file do
  let(:fixture_file) { 'spec/fixtures/warprc'}
  let(:warprc_args)  { " --config #{fixture_file}" }
  let(:config_path) { '/tmp/warprc' }
  let(:file) {
    FileUtils.cp(fixture_file, config_path)
    File.new(config_path)
  }
  let(:config) { Warp::Dir::Config.new(warprc: file.path) }
end

RSpec.shared_context :initialized_store do
  let(:store) { Warp::Dir::Store.new(config) }
  let(:wp_path) { ENV['HOME'] + '/workspace/tinker-mania' }
  let(:wp_name) { 'harro' }
  let(:point) { Warp::Dir::Point.new(wp_name, wp_path) }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
warp-dir-1.1.3 spec/spec_helper.rb
warp-dir-1.1.2 spec/spec_helper.rb
warp-dir-1.1.1 spec/spec_helper.rb