Skip to content

Commit 7ed1fb1

Browse files
Cleanup requires in generators tests, fixing issue with load error in Ruby 1.9.2
1 parent b50fd1a commit 7ed1fb1

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
require "rubygems"
22
require "rails/generators/test_case"
3-
require File.join(File.dirname(__FILE__), "../../lib/generators/devise/install_generator")
4-
require File.join(File.dirname(__FILE__), "../../lib/generators/devise/views_generator")
3+
require File.expand_path("../../../lib/generators/devise/install_generator", __FILE__)
4+
require File.expand_path("../../../lib/generators/devise/views_generator", __FILE__)
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
require File.join(File.dirname(__FILE__),"generators_test_helper.rb")
1+
require File.expand_path("../generators_test_helper", __FILE__)
22

33
class InstallGeneratorTest < Rails::Generators::TestCase
44
tests Devise::Generators::InstallGenerator
5-
destination File.expand_path("../tmp", File.dirname(__FILE__))
5+
destination File.expand_path("../../tmp", __FILE__)
66
setup :prepare_destination
77

88
test "Assert all files are properly created" do
99
run_generator
10-
assert_file "config/initializers/devise.rb"
10+
assert_file "config/initializers/devise.rb"
1111
assert_file "config/locales/devise.en.yml"
1212
end
13-
1413
end
+13-15
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
require File.join(File.dirname(__FILE__),"generators_test_helper.rb")
1+
require File.expand_path("../generators_test_helper", __FILE__)
22

33
class ViewsGeneratorTest < Rails::Generators::TestCase
44
tests Devise::Generators::ViewsGenerator
5-
destination File.expand_path("../tmp", File.dirname(__FILE__))
5+
destination File.expand_path("../../tmp", __FILE__)
66
setup :prepare_destination
77

88
test "Assert all views are properly created with no params" do
@@ -20,18 +20,16 @@ class ViewsGeneratorTest < Rails::Generators::TestCase
2020

2121
def assert_files(scope = nil, template_engine = nil)
2222
scope = "devise" if scope.nil?
23-
assert_file "app/views/#{scope}/confirmations/new.html.erb"
24-
assert_file "app/views/#{scope}/mailer/confirmation_instructions.html.erb"
25-
assert_file "app/views/#{scope}/mailer/reset_password_instructions.html.erb"
26-
assert_file "app/views/#{scope}/mailer/unlock_instructions.html.erb"
27-
assert_file "app/views/#{scope}/passwords/edit.html.erb"
28-
assert_file "app/views/#{scope}/passwords/new.html.erb"
29-
assert_file "app/views/#{scope}/registrations/new.html.erb"
30-
assert_file "app/views/#{scope}/registrations/edit.html.erb"
31-
assert_file "app/views/#{scope}/sessions/new.html.erb"
32-
assert_file "app/views/#{scope}/shared/_links.erb"
33-
assert_file "app/views/#{scope}/unlocks/new.html.erb"
34-
23+
assert_file "app/views/#{scope}/confirmations/new.html.erb"
24+
assert_file "app/views/#{scope}/mailer/confirmation_instructions.html.erb"
25+
assert_file "app/views/#{scope}/mailer/reset_password_instructions.html.erb"
26+
assert_file "app/views/#{scope}/mailer/unlock_instructions.html.erb"
27+
assert_file "app/views/#{scope}/passwords/edit.html.erb"
28+
assert_file "app/views/#{scope}/passwords/new.html.erb"
29+
assert_file "app/views/#{scope}/registrations/new.html.erb"
30+
assert_file "app/views/#{scope}/registrations/edit.html.erb"
31+
assert_file "app/views/#{scope}/sessions/new.html.erb"
32+
assert_file "app/views/#{scope}/shared/_links.erb"
33+
assert_file "app/views/#{scope}/unlocks/new.html.erb"
3534
end
36-
3735
end

0 commit comments

Comments
 (0)