diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d9635e7..eeb0d8c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,7 +81,7 @@ Specs run in randomized order. The seed is printed at the start of the run, e.g.: ``` -==> Randomized with seed 12345 (reproduce: bundle exec rspec --seed 12345) +Randomized with seed 12345 ``` To reproduce that exact run: diff --git a/spec/plsql/procedure_spec.rb b/spec/plsql/procedure_spec.rb index 7e4efc5..4cee3b9 100644 --- a/spec/plsql/procedure_spec.rb +++ b/spec/plsql/procedure_spec.rb @@ -1506,8 +1506,9 @@ def new_candidate(status) describe "using Oracle 9.2" do before(:all) do - # get actual database_version - plsql.connect! CONNECTION_PARAMS + # get actual database_version using the outer describe's connection; + # calling plsql.connect! here would orphan the outer session, leaking + # ruby__* temporary tables when this skip fires. skip "Skip if the actual database version is 18c or higher" if (plsql.connection.database_version <=> [18, 0, 0, 0]) >= 0 end diff --git a/spec/plsql/schema_spec.rb b/spec/plsql/schema_spec.rb index d540e3e..0c5760d 100644 --- a/spec/plsql/schema_spec.rb +++ b/spec/plsql/schema_spec.rb @@ -120,7 +120,7 @@ end after(:all) do - plsql.connection.logoff + plsql.logoff end it "should find existing schema" do @@ -193,6 +193,10 @@ class TestModel < TestBaseModel end end + after(:all) do + plsql.activerecord_class = nil + end + before(:each) do plsql.activerecord_class = ActiveRecord::Base end diff --git a/spec/plsql/variable_spec.rb b/spec/plsql/variable_spec.rb index 45fa68c..98ba2c8 100644 --- a/spec/plsql/variable_spec.rb +++ b/spec/plsql/variable_spec.rb @@ -112,6 +112,10 @@ SQL end + before(:each) do + plsql.execute "BEGIN DBMS_SESSION.RESET_PACKAGE; END;" + end + after(:all) do plsql.execute "DROP PACKAGE test_package" plsql.logoff diff --git a/spec/plsql/view_spec.rb b/spec/plsql/view_spec.rb index 6d6df83..93dbc60 100644 --- a/spec/plsql/view_spec.rb +++ b/spec/plsql/view_spec.rb @@ -196,9 +196,10 @@ end it "should select record in view using :column => nil condition" do - employee = @employees.last - employee[:employee_id] = employee[:employee_id] + 1 - employee[:hire_date] = nil + employee = @employees.last.merge( + employee_id: @employees.last[:employee_id] + 1, + hire_date: nil + ) plsql.test_employees_v.insert employee expect(plsql.test_employees_v.first("WHERE hire_date IS NULL")).to eq(employee) expect(plsql.test_employees_v.first(hire_date: nil)).to eq(employee) diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index d4254ee..0000000 --- a/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---colour ---format -progress ---loadby -mtime ---reverse \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bb3591d..0eec81a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -120,3 +120,8 @@ def only(*whitelist) self.reject { |key, value| !whitelist.include?(key) } end unless method_defined?(:only) end + +RSpec.configure do |config| + config.order = :random + Kernel.srand config.seed +end