Skip to content

Commit

Permalink
Merge pull request #3343 from rmosolgo/fix-generator-tests
Browse files Browse the repository at this point in the history
Try to fix generators loading and warnings
  • Loading branch information
Robert Mosolgo authored Feb 16, 2021
2 parents 066cef3 + 660122a commit 3d3ea05
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/generators/graphql/install_generator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require_relative 'core'
require_relative 'relay'
Expand Down
1 change: 1 addition & 0 deletions lib/generators/graphql/loader_generator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true
require 'rails/generators'
require "rails/generators/named_base"
require_relative "core"

Expand Down
1 change: 1 addition & 0 deletions lib/generators/graphql/mutation_generator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/named_base'
require_relative 'core'

Expand Down
1 change: 1 addition & 0 deletions lib/generators/graphql/relay_generator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require_relative 'core'
require_relative 'relay'
Expand Down
1 change: 1 addition & 0 deletions lib/generators/graphql/type_generator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/base'
require 'graphql'
require 'active_support'
Expand Down
2 changes: 0 additions & 2 deletions spec/integration/mongoid/spec_helper.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def setup(directory = "app/graphql")
prepare_destination
FileUtils.cd(File.expand_path("../../../tmp", File.dirname(__FILE__))) do
`rm -rf dummy`
`rails new dummy --skip-active-record --skip-test-unit --skip-spring --skip-bundle`
`rails new dummy --skip-active-record --skip-test-unit --skip-spring --skip-bundle --skip-webpack-install`
end

FileUtils.cd(destination_root) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class GraphQLGeneratorsRelayGeneratorTest < Rails::Generators::TestCase
prepare_destination

FileUtils.cd(File.join(destination_root, '..')) do
`rails new dummy --skip-active-record --skip-test-unit --skip-spring --skip-bundle`
`rails new dummy --skip-active-record --skip-test-unit --skip-spring --skip-bundle --skip-webpack-install`

FileUtils.cd("dummy") do
`rails generate graphql:install`
Expand Down
10 changes: 7 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,17 @@ def testing_mongoid?
require f
end

if testing_rails?
require "integration/rails/spec_helper"
end

# Load dependencies
['Mongoid', 'Rails'].each do |integration|
begin
Object.const_get(integration)
Dir["#{File.dirname(__FILE__)}/integration/#{integration.downcase}/**/*.rb"].each do |f|
if f.end_with?("spec_helper.rb") || ENV["TEST"].nil?
require f
if ENV["TEST"].nil?
Dir["spec/integration/#{integration.downcase}/**/*.rb"].each do |f|
require f.sub("spec/", "")
end
end
rescue NameError
Expand Down

0 comments on commit 3d3ea05

Please sign in to comment.