Skip to content

Commit

Permalink
Merge pull request #154 from richmolj/master
Browse files Browse the repository at this point in the history
Fix Vandal Loading
  • Loading branch information
richmolj authored May 27, 2019
2 parents c33e1d2 + bfa4932 commit 6e87d5e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/graphiti/resource/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ def self.inherited(klass)
klass.attribute :id, :integer_id
end
klass.stat total: [:count]

if defined?(::Rails) && ::Rails.env.development?
# Avoid adding dupe resources when re-autoloading
Graphiti.resources.reject! { |r| r.name == klass.name }
end
Graphiti.resources << klass
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/graphiti/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Graphiti
VERSION = "1.2.0"
VERSION = "1.2.1"
end
2 changes: 1 addition & 1 deletion spec/remote_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def request_headers

context "when Rails" do
before do
stub_const("Rails", true)
stub_const("Rails", double.as_null_object)
end

it "forwards Authorization header to the remote endpoint" do
Expand Down
2 changes: 1 addition & 1 deletion spec/resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
before do
rails = double \
application: double(config: double(eager_load: eager_load))
stub_const("Rails", rails)
stub_const("Rails", rails.as_null_object)
end

context "and eager loading" do
Expand Down
2 changes: 1 addition & 1 deletion spec/schema_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ def self.name
context "when Rails is defined" do
let(:rails) do
app = double(eager_load!: true, config: double.as_null_object)
double(application: app)
double(application: app).as_null_object
end

before do
Expand Down

0 comments on commit 6e87d5e

Please sign in to comment.