File tree Expand file tree Collapse file tree 4 files changed +17
-18
lines changed
Expand file tree Collapse file tree 4 files changed +17
-18
lines changed Original file line number Diff line number Diff line change 1- require File . expand_path ( File . dirname ( __FILE__ ) + " /test_client")
1+ require_relative ".. /test_client"
22require "launchy"
33
44module InfluxDB
@@ -25,11 +25,24 @@ def save_and_open_metrics
2525 ::Launchy . open ( file_path )
2626 end
2727
28- private
29-
3028 def metrics
3129 TestClient . metrics
3230 end
31+
32+ RSpec . configure do |config |
33+ config . before :each do
34+ InfluxDB ::Rails . instance_variable_set :@configuration , nil
35+ InfluxDB ::Rails . configure
36+
37+ allow ( InfluxDB ::Rails ) . to receive ( :client ) . and_return ( InfluxDB ::Rails ::TestClient . new )
38+ allow_any_instance_of ( InfluxDB ::Rails ::Configuration )
39+ . to receive ( :ignored_environments ) . and_return ( %w[ development ] )
40+
41+ InfluxDB ::Rails ::TestClient . metrics . clear
42+ end
43+
44+ config . include InfluxDB ::Rails ::Matchers
45+ end
3346 end
3447 end
3548end
File renamed without changes.
Original file line number Diff line number Diff line change 11$LOAD_PATH. unshift ( File . join ( File . dirname ( __FILE__ ) , ".." , "lib" ) )
22$LOAD_PATH. unshift ( File . dirname ( __FILE__ ) )
33require "active_support"
4- require File . expand_path ( File . dirname ( __FILE__ ) + "/support/matchers" )
4+ require_relative "../lib/influxdb/rails/helpers/rspec_matchers"
55require File . expand_path ( File . dirname ( __FILE__ ) + "/support/broken_client" )
66
77ENV [ "RAILS_ENV" ] ||= "test"
2929 # use expect syntax
3030 config . disable_monkey_patching!
3131
32- # reset configuration for each spec
33- config . before :each do
34- InfluxDB ::Rails . instance_variable_set :@configuration , nil
35- InfluxDB ::Rails . configure
36-
37- allow ( InfluxDB ::Rails ) . to receive ( :client ) . and_return ( InfluxDB ::Rails ::TestClient . new )
38- allow_any_instance_of ( InfluxDB ::Rails ::Configuration ) . to receive ( :ignored_environments ) . and_return ( %w[ development ] )
39-
40- InfluxDB ::Rails ::TestClient . metrics . clear
41- end
42-
4332 config . after ( :each ) do
4433 travel_back
4534 end
4635
4736 config . include ActiveSupport ::Testing ::TimeHelpers
4837 config . include ActiveJob ::TestHelper
49- config . include InfluxDB ::Rails ::Matchers
5038 config . include InfluxDB ::Rails ::BrokenClient
5139end
Original file line number Diff line number Diff line change 1- require File . expand_path ( File . dirname ( __FILE__ ) + "/test_client" )
2-
31module InfluxDB
42 module Rails
53 module BrokenClient
You can’t perform that action at this time.
0 commit comments