Skip to content

Commit 6eac851

Browse files
committedFeb 7, 2014
spec/database/sql: set size at a lower limit for tests
1 parent e9a017a commit 6eac851

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed
 

‎spec/database/sql_spec.rb

+14-13
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,30 @@
22
require 'browser/database/sql'
33

44
describe Browser::Database::SQL do
5-
SQL = Browser::Database::SQL
5+
SQL = Browser::Database::SQL
6+
SIZE = 1024 * 1024
67

78
describe '#new' do
89
it 'sets the attributes properly' do
9-
sql = SQL.new('test', description: 'trains', size: 1024)
10+
sql = SQL.new('test', description: 'trains', size: SIZE)
1011

1112
expect(sql.name).to eq('test')
1213
expect(sql.description).to eq('trains')
13-
expect(sql.size).to eq(1024)
14+
expect(sql.size).to eq(SIZE)
1415
end
1516

1617
it 'sets the version properly' do
17-
sql = SQL.new('test2', version: '1.0')
18+
sql = SQL.new('test2', version: '1.0', size: SIZE)
1819
expect(sql.version).to eq('1.0')
1920

20-
sql = SQL.new('test')
21+
sql = SQL.new('test', size: SIZE)
2122
expect(sql.version).to eq('')
2223
end
2324
end
2425

2526
describe '#transaction' do
2627
async 'calls the block with the transaction' do
27-
sql = SQL.new('test')
28+
sql = SQL.new('test', size: SIZE)
2829

2930
sql.transaction {|t|
3031
async {
@@ -34,7 +35,7 @@
3435
end
3536

3637
async 'the transaction database is the right one' do
37-
sql = SQL.new('test')
38+
sql = SQL.new('test', size: SIZE)
3839

3940
sql.transaction {|t|
4041
async {
@@ -47,7 +48,7 @@
4748
describe SQL::Transaction do
4849
describe '#query' do
4950
async 'returns a promise' do
50-
sql = SQL.new('test')
51+
sql = SQL.new('test', size: SIZE)
5152

5253
sql.transaction {|t|
5354
async {
@@ -57,7 +58,7 @@
5758
end
5859

5960
async 'resolves on success' do
60-
sql = SQL.new('test')
61+
sql = SQL.new('test', size: SIZE)
6162

6263
sql.transaction {|t|
6364
t.query('CREATE TABLE IF NOT EXISTS test(ID INTEGER PRIMARY KEY ASC, a TEXT)').then {|r|
@@ -69,7 +70,7 @@
6970
end
7071

7172
async 'rejects on failure' do
72-
sql = SQL.new('test')
73+
sql = SQL.new('test', size: SIZE)
7374

7475
sql.transaction {|t|
7576
t.query('huehue').rescue {|e|
@@ -85,7 +86,7 @@
8586
describe SQL::Result do
8687
describe '#length' do
8788
async 'has the proper length' do
88-
sql = SQL.new('test')
89+
sql = SQL.new('test', size: SIZE)
8990

9091
sql.transaction {|t|
9192
t.query('SELECT 1').then {|r|
@@ -99,7 +100,7 @@
99100

100101
describe '#[]' do
101102
async 'returns a row' do
102-
sql = SQL.new('test')
103+
sql = SQL.new('test', size: SIZE)
103104

104105
sql.transaction {|t|
105106
t.query('SELECT 1, 2, 3').then {|r|
@@ -114,7 +115,7 @@
114115
end
115116

116117
async 'returns nil on missing row' do
117-
sql = SQL.new('test')
118+
sql = SQL.new('test', size: SIZE)
118119

119120
sql.transaction {|t|
120121
t.query('SELECT 1, 2, 3').then {|r|

0 commit comments

Comments
 (0)
Please sign in to comment.