Skip to content

Commit 2f09d66

Browse files
committed
Notes on creating test DBs and user.
1 parent 7785e88 commit 2f09d66

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

RUNNING_UNIT_TESTS.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,28 @@ This process is much easier than it has been before!
99
Default testing uses DBLIB with TinyTDS.
1010

1111
* Setup two databases in SQL Server, [activerecord_unittest] and [activerecord_unittest2]
12-
* Create a [rails] user with an empty password and give it a [db_owner] role to both DBs. Some tests require a server role of [sysadmin] too.
12+
* Create a [rails] user with an empty password and give it a [db_owner] role to both DBs. Some tests require a server role of [sysadmin] too. See the following screenshots or the SQL snippet below.
1313
- http://twitpic.com/9bsiyp/full
1414
- http://twitpic.com/9bsj7z/full
1515
- http://twitpic.com/9bsjdx/full
1616
- http://twitpic.com/9bsjl7/full
1717
* $ bundle install
1818
* $ bundle exec rake test ACTIVERECORD_UNITTEST_HOST='my.db.net'
1919

20+
```sql
21+
CREATE DATABASE [activerecord_unittest];
22+
CREATE DATABASE [activerecord_unittest2];
23+
GO
24+
CREATE LOGIN [rails] WITH PASSWORD = '', CHECK_POLICY = OFF, DEFAULT_DATABASE = [activerecord_unittest];
25+
GO
26+
USE [activerecord_unittest];
27+
CREATE USER [rails] FOR LOGIN [rails];
28+
GO
29+
EXEC sp_addrolemember N'db_owner', N'rails';
30+
EXEC master..sp_addsrvrolemember @loginame = N'rails', @rolename = N'sysadmin'
31+
GO
32+
```
33+
2034
Focusing tests. Use the `ONLY_` env vars to run either ours or the ActiveRecord cases. Use the `TEST_FILES` env variants to focus on specific test(s), use commas for multiple cases. Note, you have to use different env vars to focus only on ours or a core ActiveRecord case. There may be failures when focusing on an ActiveRecord case since our coereced test files is not loaded in this scenerio.
2135

2236
```

0 commit comments

Comments
 (0)