Thank you!

On Thursday, June 15, 2017 at 12:12:31 PM UTC-7, Jeremy Evans wrote:
>
> On Thursday, June 15, 2017 at 10:53:13 AM UTC-7, Andrei (L.A.) wrote:
>>
>> Working on a small ruby app and wondering what's the most efficient way 
>> to set a database for testing.
>>
>> I didn't see an example showing how to swap the database in the tests. 
>>
>> What would be the appropriate way to test the User model in a situation 
>> like this, replacing the production database in the original connection:
>>
>> DB = Sequel.connect(SECRETS[:db_connection_params]) # connects to a 
>> mssql server
>>
>> class User < Sequel::Model(:users)
>> end
>>
>>
>> Connection params:
>>
>> :db_connection_params:
>>   :adapter: 'tinytds'
>>   :host: '***'
>>   :port: '1433' # Required when using other that 1433 (default)
>>   :database: 'prod'
>>   :user: '***'
>>   :password: '***'
>>   :timeout: 30
>>
>>
> Something like:
>
> DB = Sequel.connect(SECRETS[testing ? :test_db_connection_params : 
> :db_connection_params])
>
> In general if you want to support development/testing/production 
> environments, you should probably have some support of conditional code 
> that runs that does the appropriate setup for the environment.
>
> Thanks,
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to