Skip to content

Commit 076bc16

Browse files
authored
Merge pull request rsim#284 from yahonda/enable-random-spec-order
Run specs in randomized order
2 parents 29244f3 + 956cc17 commit 076bc16

7 files changed

Lines changed: 22 additions & 13 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Specs run in randomized order. The seed is printed at the start of the
8181
run, e.g.:
8282

8383
```
84-
==> Randomized with seed 12345 (reproduce: bundle exec rspec --seed 12345)
84+
Randomized with seed 12345
8585
```
8686

8787
To reproduce that exact run:

spec/plsql/procedure_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,8 +1506,9 @@ def new_candidate(status)
15061506

15071507
describe "using Oracle 9.2" do
15081508
before(:all) do
1509-
# get actual database_version
1510-
plsql.connect! CONNECTION_PARAMS
1509+
# get actual database_version using the outer describe's connection;
1510+
# calling plsql.connect! here would orphan the outer session, leaking
1511+
# ruby_<outer_sid>_* temporary tables when this skip fires.
15111512
skip "Skip if the actual database version is 18c or higher" if (plsql.connection.database_version <=> [18, 0, 0, 0]) >= 0
15121513
end
15131514

spec/plsql/schema_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
end
121121

122122
after(:all) do
123-
plsql.connection.logoff
123+
plsql.logoff
124124
end
125125

126126
it "should find existing schema" do
@@ -193,6 +193,10 @@ class TestModel < TestBaseModel
193193
end
194194
end
195195

196+
after(:all) do
197+
plsql.activerecord_class = nil
198+
end
199+
196200
before(:each) do
197201
plsql.activerecord_class = ActiveRecord::Base
198202
end

spec/plsql/variable_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112
SQL
113113
end
114114

115+
before(:each) do
116+
plsql.execute "BEGIN DBMS_SESSION.RESET_PACKAGE; END;"
117+
end
118+
115119
after(:all) do
116120
plsql.execute "DROP PACKAGE test_package"
117121
plsql.logoff

spec/plsql/view_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,10 @@
196196
end
197197

198198
it "should select record in view using :column => nil condition" do
199-
employee = @employees.last
200-
employee[:employee_id] = employee[:employee_id] + 1
201-
employee[:hire_date] = nil
199+
employee = @employees.last.merge(
200+
employee_id: @employees.last[:employee_id] + 1,
201+
hire_date: nil
202+
)
202203
plsql.test_employees_v.insert employee
203204
expect(plsql.test_employees_v.first("WHERE hire_date IS NULL")).to eq(employee)
204205
expect(plsql.test_employees_v.first(hire_date: nil)).to eq(employee)

spec/spec.opts

Lines changed: 0 additions & 6 deletions
This file was deleted.

spec/spec_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,8 @@ def only(*whitelist)
120120
self.reject { |key, value| !whitelist.include?(key) }
121121
end unless method_defined?(:only)
122122
end
123+
124+
RSpec.configure do |config|
125+
config.order = :random
126+
Kernel.srand config.seed
127+
end

0 commit comments

Comments
 (0)