11# TODO: Write proper specs
2+ require "rails_helper"
23
34RSpec . describe Graphiti ::Rails ::Railtie do
5+ before do
6+ stub_const ( "::Rails" , rails )
7+ Graphiti . instance_variable_set ( :@config , nil )
8+ end
9+
10+ after do
11+ Graphiti . instance_variable_set ( :@config , nil )
12+ end
13+
414 describe "when rails is defined with logger" do
515 let ( :rails ) do
616 logger = OpenStruct . new ( level : 1 )
@@ -11,15 +21,6 @@ def logger.debug?
1121 double ( root : Pathname . new ( "/foo/bar" ) , logger : logger )
1222 end
1323
14- before do
15- stub_const ( "::Rails" , rails )
16- Graphiti . instance_variable_set ( :@config , nil )
17- end
18-
19- after do
20- Graphiti . instance_variable_set ( :@config , nil )
21- end
22-
2324 describe "#schema_path" do
2425 it "defaults" do
2526 expect ( Graphiti . config . schema_path . to_s )
@@ -50,11 +51,7 @@ def logger.debug?
5051 end
5152
5253 context "when Rails is defined without logger" do
53- before do
54- rails = double ( root : Pathname . new ( "/foo/bar" ) , logger : double . as_null_object )
55- stub_const ( "::Rails" , rails )
56- Graphiti . instance_variable_set ( :@config , nil )
57- end
54+ let ( :rails ) { stub_const ( "::Rails" , double ( root : Pathname . new ( "/foo/bar" ) , logger : nil ) ) }
5855
5956 it "defaults" do
6057 expect ( Graphiti . config . schema_path . to_s )
0 commit comments