Sha256: 16cd23e1e16e6f5d889d0d40a998cc7c9e7e5506e34954b740af82a65ac2d030

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 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!
  end
end

RSpec.shared_context :fake_serializer do
  let(:file) { @file ||= ::Tempfile.new('warp-dir') }
  let(:config) { Warp::Dir::Config.new(config: 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(:config_path) { '/tmp/warprc' }
  let(:file) {
    FileUtils.cp(fixture_file, config_path)
    File.new(config_path)
  }
  let(:config) { Warp::Dir::Config.new(config: 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

1 entries across 1 versions & 1 rubygems

Version Path
warp-dir-1.1.0 spec/spec_helper.rb