0
@@ -17,31 +17,31 @@ class TestMerbPath < Test::Unit::TestCase
0
assert_equal File.expand_path(File.dirname(__FILE__) + '/app_fixtures'), MerbPath.new.merb_root
0
assert_equal "rb", @rp_controller.extension
0
assert_equal "erb", @rp_view.extension
0
assert_equal :controller, @rp_controller.file_type
0
assert_equal :view, @rp_view.file_type
0
assert_equal [], @rp_controller.modules
0
assert_equal ['admin'], @rp_controller_with_module.modules
0
assert_equal [], @rp_view.modules
0
assert_equal ['admin'], @rp_view_with_module.modules
0
def test_controller_name
0
rp = MerbPath.new(FIXTURE_PATH + '/app/models/person.rb')
0
- assert_equal "people", rp.controller_name
0
+ assert_equal "people", rp.controller_name
0
rp = MerbPath.new(FIXTURE_PATH + '/app/models/user.rb')
0
- assert_equal "users", rp.controller_name
0
+ assert_equal "users", rp.controller_name
0
rp = MerbPath.new(FIXTURE_PATH + '/app/models/users.rb')
0
- assert_equal "users", rp.controller_name
0
+ assert_equal "users", rp.controller_name
0
@@ -52,7 +52,7 @@ class TestMerbPath < Test::Unit::TestCase
0
assert_equal('new', basename)
0
assert_equal('html', content_type)
0
assert_equal('erb', extension)
0
current_file = MerbPath.new(FIXTURE_PATH + '/app/views/user/new.rhtml')
0
pathname, basename, content_type, extension = current_file.parse_file_parts
0
assert_equal(FIXTURE_PATH + '/app/views/user', pathname)
0
@@ -60,7 +60,7 @@ class TestMerbPath < Test::Unit::TestCase
0
assert_equal(nil, content_type)
0
assert_equal('rhtml', extension)
0
def test_new_merb_path_has_parts
0
current_file = MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb')
0
assert_equal(FIXTURE_PATH + '/app/views/users/new.html.erb', current_file.filepath)
0
@@ -68,25 +68,25 @@ class TestMerbPath < Test::Unit::TestCase
0
assert_equal('new', current_file.file_name)
0
assert_equal('html', current_file.content_type)
0
assert_equal('erb', current_file.extension)
0
def test_controller_name_and_action_name_for_controller
0
rp = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
assert_equal "users", rp.controller_name
0
assert_equal nil, rp.action_name
0
TextMate.line_number = '3'
0
rp = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
assert_equal "users", rp.controller_name
0
assert_equal "new", rp.action_name
0
TextMate.line_number = '7'
0
rp = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
assert_equal "users", rp.controller_name
0
assert_equal "create", rp.action_name
0
def test_controller_name_and_action_name_for_view
0
rp = MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb')
0
assert_equal "users", rp.controller_name
0
@@ -97,80 +97,78 @@ class TestMerbPath < Test::Unit::TestCase
0
rp = MerbPath.new(FIXTURE_PATH + '/app/views/people/new.html.erb')
0
assert_equal "people", rp.controller_name
0
def test_controller_name_suggestion_when_controller_absent
0
rp = MerbPath.new(FIXTURE_PATH + '/app/views/people/new.html.erb')
0
assert_equal "people", rp.controller_name
0
- # def test_merb_path_for
0
- # [FIXTURE_PATH + '/app/controllers/users.rb', :helper, FIXTURE_PATH + '/app/helpers/user_helper.rb'],
0
- # [FIXTURE_PATH + '/app/controllers/users.rb', :javascript, FIXTURE_PATH + '/public/javascripts/user.js'],
0
- # [FIXTURE_PATH + '/app/controllers/users.rb', :functional_test, FIXTURE_PATH + '/test/functional/user_controller_test.rb'],
0
- # [FIXTURE_PATH + '/app/helpers/user_helper.rb', :controller, FIXTURE_PATH + '/app/controllers/users_controller.rb'],
0
- # [FIXTURE_PATH + '/app/models/user.rb', :controller, FIXTURE_PATH + '/app/controllers/users_controller.rb'],
0
- # [FIXTURE_PATH + '/app/models/post.rb', :controller, FIXTURE_PATH + '/app/controllers/posts_controller.rb'],
0
- # [FIXTURE_PATH + '/test/fixtures/users.yml', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
- # [FIXTURE_PATH + '/spec/fixtures/users.yml', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
- # [FIXTURE_PATH + '/app/controllers/users.rb', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
- # [FIXTURE_PATH + '/test/fixtures/users.yml', :unit_test, FIXTURE_PATH + '/test/unit/user_test.rb'],
0
- # [FIXTURE_PATH + '/app/models/user.rb', :fixture, FIXTURE_PATH + '/test/fixtures/users.yml'],
0
- # [FIXTURE_PATH + '/app/controllers/admin/base_controller.rb', :helper, FIXTURE_PATH + '/app/helpers/admin/base_helper.rb'],
0
- # [FIXTURE_PATH + '/app/controllers/admin/inside/outside_controller.rb', :javascript, FIXTURE_PATH + '/public/javascripts/admin/inside/outside.js'],
0
- # [FIXTURE_PATH + '/app/controllers/admin/base_controller.rb', :functional_test, FIXTURE_PATH + '/test/functional/admin/base_controller_test.rb'],
0
- # [FIXTURE_PATH + '/app/helpers/admin/base_helper.rb', :controller, FIXTURE_PATH + '/app/controllers/admin/base_controller.rb'],
0
- # # TODO Add [posts.yml, :model, post.rb]
0
- # for pair in partners
0
- # assert_equal MerbPath.new(pair[2]), MerbPath.new(pair[0]).merb_path_for(pair[1])
0
- # # Test controller to view
0
- # ENV['RAILS_VIEW_EXT'] = nil
0
- # TextMate.line_number = '6'
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/user/create.html.erb'), current_file.merb_path_for(:view)
0
- # # 2.0 plural controllers
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users_controller.rb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/create.html.erb'), current_file.merb_path_for(:view)
0
- # TextMate.line_number = '3'
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/user/new.rhtml'), current_file.merb_path_for(:view)
0
- # # 2.0 plural controllers
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users_controller.rb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb'), current_file.merb_path_for(:view)
0
- # # Test view to controller
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/views/user/new.html.erb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/controllers/users_controller.rb'), current_file.merb_path_for(:controller)
0
- # # 2.0 plural controllers
0
- # current_file = MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb')
0
- # assert_equal MerbPath.new(FIXTURE_PATH + '/app/controllers/users_controller.rb'), current_file.merb_path_for(:controller)
0
+ def test_merb_path_for
0
+ [FIXTURE_PATH + '/app/controllers/users.rb', :helper, FIXTURE_PATH + '/app/helpers/users_helper.rb'],
0
+ [FIXTURE_PATH + '/app/controllers/users.rb', :javascript, FIXTURE_PATH + '/public/javascripts/users.js'],
0
+ [FIXTURE_PATH + '/app/controllers/users.rb', :functional_test, FIXTURE_PATH + '/test/functional/users_test.rb'],
0
+ [FIXTURE_PATH + '/app/helpers/users_helper.rb', :controller, FIXTURE_PATH + '/app/controllers/users.rb'],
0
+ [FIXTURE_PATH + '/app/models/user.rb', :controller, FIXTURE_PATH + '/app/controllers/users.rb'],
0
+ [FIXTURE_PATH + '/app/models/post.rb', :controller, FIXTURE_PATH + '/app/controllers/posts.rb'],
0
+ # [FIXTURE_PATH + '/test/fixtures/users.yml', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
+ # [FIXTURE_PATH + '/spec/fixtures/users.yml', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
+ [FIXTURE_PATH + '/app/controllers/users.rb', :model, FIXTURE_PATH + '/app/models/user.rb'],
0
+ # [FIXTURE_PATH + '/test/fixtures/users.yml', :unit_test, FIXTURE_PATH + '/test/unit/user_test.rb'],
0
+ # [FIXTURE_PATH + '/app/models/user.rb', :fixture, FIXTURE_PATH + '/test/fixtures/users.yml'],
0
+ [FIXTURE_PATH + '/app/controllers/admin/bases.rb', :helper, FIXTURE_PATH + '/app/helpers/admin/bases_helper.rb'],
0
+ [FIXTURE_PATH + '/app/controllers/admin/inside/outside.rb', :javascript, FIXTURE_PATH + '/public/javascripts/admin/inside/outside.js'],
0
+ [FIXTURE_PATH + '/app/controllers/admin/bases.rb', :functional_test, FIXTURE_PATH + '/test/functional/admin/bases_test.rb'],
0
+ [FIXTURE_PATH + '/app/helpers/admin/base_helper.rb', :controller, FIXTURE_PATH + '/app/controllers/admin/bases.rb'],
0
+ assert_equal MerbPath.new(pair[2]), MerbPath.new(pair[0]).merb_path_for(pair[1]), pair.inspect
0
+ # Test controller to view
0
+ ENV['RAILS_VIEW_EXT'] = nil
0
+ TextMate.line_number = '8'
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/create.html.erb'), current_file.merb_path_for(:view)
0
+ # 2.0 plural controllers
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/create.html.erb'), current_file.merb_path_for(:view)
0
+ TextMate.line_number = '3'
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb'), current_file.merb_path_for(:view)
0
+ # 2.0 plural controllers
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb'), current_file.merb_path_for(:view)
0
+ # Test view to controller
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/views/user/new.html.erb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb'), current_file.merb_path_for(:controller)
0
+ # 2.0 plural controllers
0
+ current_file = MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb')
0
+ assert_equal MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb'), current_file.merb_path_for(:controller)
0
assert_equal(nil, MerbPath.new(FIXTURE_PATH + '/config/init.rb').best_match)
0
- # assert_equal(:functional_test, MerbPath.new(FIXTURE_PATH + '/app/controllers/posts_controller.rb').best_match)
0
- assert_equal(:helper, MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb').best_match)
0
+ assert_equal(:functional_test, MerbPath.new(FIXTURE_PATH + '/app/controllers/posts.rb').best_match)
0
TextMate.line_number = '3' # new action
0
- assert_equal(:view, MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb').best_match)
0
+ assert_equal(:view, MerbPath.new(FIXTURE_PATH + '/app/controllers/users.rb').best_match)
0
TextMate.line_number = '0'
0
assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/users/new.html.erb').best_match)
0
- assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/admin/base/action.html.erb').best_match)
0
- assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/notifier/forgot_password.html.erb').best_match)
0
- assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/books/new.haml').best_match)
0
+ assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/admin/base/action.html.erb').best_match)
0
+ assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/notifier/forgot_password.html.erb').best_match)
0
+ assert_equal(:controller, MerbPath.new(FIXTURE_PATH + '/app/views/books/new.haml').best_match)
0
# assert_equal false, @rp_view.wants_haml
0
@@ -181,48 +179,48 @@ class TestMerbPath < Test::Unit::TestCase
0
# TextMate.project_directory = File.expand_path(File.dirname(__FILE__) + '/app_fixtures')
0
# haml_fixture_path = File.expand_path(File.dirname(__FILE__) + '/fixtures')
0
# TextMate.project_directory = haml_fixture_path
0
# assert_equal [], MerbPath.new(haml_fixture_path + '/public/stylesheets/sass/posts.sass').modules
0
# assert_equal ["admin"], MerbPath.new(haml_fixture_path + '/public/stylesheets/sass/admin/posts.sass').modules
0
# # Going from controller to view
0
# current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
# TextMate.line_number = '2'
0
# assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/new.html.haml'), current_file.merb_path_for(:view)
0
# current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
# TextMate.line_number = '12'
0
# assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/index.html.haml'), current_file.merb_path_for(:view)
0
# current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
# TextMate.line_number = '13'
0
# assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/index.xml.builder'), current_file.merb_path_for(:view)
0
# current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
# TextMate.line_number = '14'
0
# assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/index.js.rjs'), current_file.merb_path_for(:view)
0
# current_file = MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb')
0
# TextMate.line_number = '15'
0
# assert_equal MerbPath.new(haml_fixture_path + '/app/views/posts/index.wacky.haml'), current_file.merb_path_for(:view)
0
# # Going from view to controller
0
# current_file = MerbPath.new(haml_fixture_path + '/app/views/posts/index.html.haml')
0
# assert_equal MerbPath.new(haml_fixture_path + '/app/controllers/posts_controller.rb'), current_file.merb_path_for(:controller)
0
# # Going from view to stylesheet
0
# current_file = MerbPath.new(haml_fixture_path + '/app/views/posts/index.html.haml')
0
# assert_equal MerbPath.new(haml_fixture_path + '/public/stylesheets/sass/posts.sass'), current_file.merb_path_for(:stylesheet)
0
# # Going from stylesheet to helper
0
# current_file = MerbPath.new(haml_fixture_path + '/public/stylesheets/sass/posts.sass')
0
# assert_equal MerbPath.new(haml_fixture_path + '/app/helpers/posts_helper.rb'), current_file.merb_path_for(:helper)
0
# TextMate.project_directory = File.expand_path(File.dirname(__FILE__) + '/app_fixtures')
Comments
No one has commented yet.