Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make mysql2 a alias of mysql when DataMapper is selected #856

Merged
merged 1 commit into from May 30, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -32,7 +32,7 @@ def setup_orm
dm-validations
).each { |dep| require_dependencies dep }
require_dependencies case options[:adapter]
when 'mysql'
when 'mysql', 'mysql2'
dm.gsub!(/!DB_DEVELOPMENT!/,"\"mysql://root@localhost/#{db}_development\"")
dm.gsub!(/!DB_PRODUCTION!/,"\"mysql://root@localhost/#{db}_production\"")
dm.gsub!(/!DB_TEST!/,"\"mysql://root@localhost/#{db}_test\"")
Expand Down
8 changes: 8 additions & 0 deletions padrino-gen/test/test_project_generator.rb
Expand Up @@ -263,6 +263,14 @@ def teardown
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
end

# DataMapper has do_mysql that is the version of MySQL driver.
should "properly generate for mysql2" do
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=mysql2') }
assert_match_in_file(/gem 'dm-mysql-adapter'/, "#{@apptmp}/sample_project/Gemfile")
assert_match_in_file(%r{"mysql://}, "#{@apptmp}/sample_project/config/database.rb")
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
end

should "properly generate for sqlite" do
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=sqlite') }
assert_match_in_file(/gem 'dm-sqlite-adapter'/, "#{@apptmp}/sample_project/Gemfile")
Expand Down