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

Fix mysql and sqlite3 database option bug #924

Closed
wants to merge 2 commits into from

Conversation

edgarlepe
Copy link

Resolves #893 and adds support for mysql.

Running suspenders with the --database option set to anything other than the default caused the following error to occur:

Specified 'some_other_database' for database adapter, but the gem is not loaded. Add `gem 'some_other_database_gem'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

This PR adds conditional statements to the Gemfile.erb template in order to add the appropriate gem to the Gemfile.

context '--database=mysql' do
include_context 'Project Setup Hook', '--database=mysql'

it 'adds mysql2 to Gemfile' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end

context '--database=mysql' do
include_context 'Project Setup Hook', '--database=mysql'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end
end

context '--database=mysql' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

context '--database=sqlite3' do
include_context 'Project Setup Hook', '--database=sqlite3'

it 'adds sqlite3 to Gemfile' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


RSpec.describe 'Suspend a new project with custom database option' do
context '--database=sqlite3' do
include_context 'Project Setup Hook', '--database=sqlite3'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end

RSpec.describe 'Suspend a new project with custom database option' do
context '--database=sqlite3' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end
end

RSpec.describe 'Suspend a new project with custom database option' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


require 'spec_helper'

RSpec.shared_context 'Project Setup Hook' do |option|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -0,0 +1,34 @@
# frozen_string_literal: true

require 'spec_helper'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

context '--database=mysql' do
include_context 'Project Setup Hook', '--database=mysql'

it 'adds mysql2 to Gemfile' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end

context '--database=mysql' do
include_context 'Project Setup Hook', '--database=mysql'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end
end

context '--database=mysql' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

context '--database=sqlite3' do
include_context 'Project Setup Hook', '--database=sqlite3'

it 'adds sqlite3 to Gemfile' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


RSpec.describe 'Suspend a new project with custom database option' do
context '--database=sqlite3' do
include_context 'Project Setup Hook', '--database=sqlite3'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end

RSpec.describe 'Suspend a new project with custom database option' do
context '--database=sqlite3' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end
end

RSpec.describe 'Suspend a new project with custom database option' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


require 'spec_helper'

RSpec.shared_context 'Project Setup Hook' do |option|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -0,0 +1,34 @@
# frozen_string_literal: true

require 'spec_helper'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@edgarlepe edgarlepe closed this Jul 26, 2018
@edgarlepe edgarlepe deleted the database-options branch July 26, 2018 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants