File tree Expand file tree Collapse file tree 4 files changed +8
-3
lines changed Expand file tree Collapse file tree 4 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,11 @@ def self.inherited(klass)
104104 klass . attribute :id , :integer_id
105105 end
106106 klass . stat total : [ :count ]
107+
108+ if defined? ( ::Rails ) && ::Rails . env . development?
109+ # Avoid adding dupe resources when re-autoloading
110+ Graphiti . resources . reject! { |r | r . name == klass . name }
111+ end
107112 Graphiti . resources << klass
108113 end
109114 end
Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ def request_headers
208208
209209 context "when Rails" do
210210 before do
211- stub_const ( "Rails" , true )
211+ stub_const ( "Rails" , double . as_null_object )
212212 end
213213
214214 it "forwards Authorization header to the remote endpoint" do
Original file line number Diff line number Diff line change 7171 before do
7272 rails = double \
7373 application : double ( config : double ( eager_load : eager_load ) )
74- stub_const ( "Rails" , rails )
74+ stub_const ( "Rails" , rails . as_null_object )
7575 end
7676
7777 context "and eager loading" do
Original file line number Diff line number Diff line change @@ -738,7 +738,7 @@ def self.name
738738 context "when Rails is defined" do
739739 let ( :rails ) do
740740 app = double ( eager_load! : true , config : double . as_null_object )
741- double ( application : app )
741+ double ( application : app ) . as_null_object
742742 end
743743
744744 before do
You can’t perform that action at this time.
0 commit comments