Permalink
Browse files

Generator template fix

By default, generated minitest _spec files raises error  ‘cannot load
such file -- spec_helper (LoadError)’ if run it individually, like
```ruby spec/foo/bar_spec.rb```.
  • Loading branch information...
sovetnik committed May 1, 2017
1 parent d5c410e commit 599215dda56e6f5931c2ef2effe2f9148b55b580
@@ -1,4 +1,4 @@
require 'spec_helper'
require_relative '../../../spec_helper'
require_relative '<%= config[:relative_action_path] %>'
describe <%= config[:app] %>::Controllers::<%= config[:controller] %>::<%= config[:action] %> do
@@ -1,4 +1,4 @@
require 'spec_helper'
require_relative '../../../spec_helper'
require_relative '<%= config[:relative_view_path] %>'
describe <%= config[:app] %>::Views::<%= config[:controller] %>::<%= config[:action] %> do
@@ -1,4 +1,4 @@
require 'spec_helper'
require_relative '../../spec_helper'
describe Mailers::<%= config[:mailer] %> do
it 'delivers email' do
@@ -1,4 +1,4 @@
require 'spec_helper'
require_relative '../../spec_helper'
describe <%= config[:model_name] %> do
# place your tests here
@@ -1,4 +1,4 @@
require 'spec_helper'
require_relative '../../spec_helper'
describe <%= config[:model_name] %>Repository do
# place your tests here
@@ -240,7 +240,7 @@ def call(params)
# spec/web/controllers/books/index_spec.rb
#
expect('spec/web/controllers/books/index_spec.rb').to have_file_content <<-END
require 'spec_helper'
require_relative '../../../spec_helper'
require_relative '../../../../apps/web/controllers/books/index'
describe Web::Controllers::Books::Index do
@@ -258,7 +258,7 @@ def call(params)
# spec/web/views/books/index_spec.rb
#
expect('spec/web/views/books/index_spec.rb').to have_file_content <<-END
require 'spec_helper'
require_relative '../../../spec_helper'
require_relative '../../../../apps/web/views/books/index'
describe Web::Views::Books::Index do
@@ -36,7 +36,7 @@ class Mailers::Welcome
# spec/bookshelf_generate_mailer/mailers/welcome_spec.rb
#
expect('spec/bookshelf_generate_mailer/mailers/welcome_spec.rb').to have_file_content <<-END
require 'spec_helper'
require_relative '../../spec_helper'
describe Mailers::Welcome do
it 'delivers email' do
@@ -76,7 +76,7 @@
# spec/<project>/entities/<model>_spec.rb
#
expect("spec/#{project}/entities/#{model}_spec.rb").to have_file_content <<-END
require 'spec_helper'
require_relative '../../spec_helper'
describe #{class_name} do
# place your tests here
@@ -87,7 +87,7 @@
# spec/<project>/repositories/<model>_repository_spec.rb
#
expect("spec/#{project}/repositories/#{model}_repository_spec.rb").to have_file_content <<-END
require 'spec_helper'
require_relative '../../spec_helper'
describe #{class_name}Repository do
# place your tests here
@@ -62,7 +62,7 @@ class #{class_name}Repository < Hanami::Repository
# spec/<project>/entities/<model>_spec.rb
#
expect("spec/#{project}/entities/#{model}_spec.rb").to have_file_content <<-END
require 'spec_helper'
require_relative '../../spec_helper'
describe #{class_name} do
# place your tests here
@@ -73,7 +73,7 @@ class #{class_name}Repository < Hanami::Repository
# spec/<project>/repositories/<model>_repository_spec.rb
#
expect("spec/#{project}/repositories/#{model}_repository_spec.rb").to have_file_content <<-END
require 'spec_helper'
require_relative '../../spec_helper'
describe #{class_name}Repository do
# place your tests here

0 comments on commit 599215d

Please sign in to comment.