Class: Vigia::Rspec

Inherits:
Object
  • Object
show all
Defined in:
lib/vigia/rspec.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.include_shared_foldersObject



4
5
6
7
# File 'lib/vigia/rspec.rb', line 4

def include_shared_folders
  require_custom_examples
  require "#{ __dir__ }/spec/support/utils"
end

Instance Method Details

#adapterObject



41
42
43
# File 'lib/vigia/rspec.rb', line 41

def adapter
  @adapter ||= Vigia.config.adapter.instance
end

#run!Object



19
20
21
22
# File 'lib/vigia/rspec.rb', line 19

def run!
  RSpec::Core::Runner::run(
    [ Vigia.spec_folder ], Vigia.config.stderr, Vigia.config.stdout)
end

#set_global_memoizers(rspec) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/vigia/rspec.rb', line 32

def set_global_memoizers(rspec)
  instance = adapter
  self.class.define_singleton_method(:adapter) { instance }
  rspec.let(:client)  { Vigia.config.http_client_class.new(http_client_options) }
  rspec.let(:result)  { client.run }
  rspec.let(:result!) { client.run! }
  rspec.let(:adapter) { instance }
end

#start_tests(rspec) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/vigia/rspec.rb', line 24

def start_tests(rspec)
  with_rspec_options do
    set_global_memoizers(rspec)

    Vigia::Sail::Group.setup_and_run_primary(rspec)
  end
end