There is no public method to clear object cache for schema.
I've found method Schema.reset_instance_variables but it is private.
We need to be able to tell ruby that object definitions were changed by Spec file or any other file.
How can we do that?
Can you give me a clue or make the reset_instance_variables public?
When performing a switch on synonyms from Real tables to test tables and back, the cache is not refreshed.
What i would like to have is ability to reset cache on after(:all).
When we run multiple tests sets, some tests are working on real tables, some other tests work on test tables.
Steps to reproduce problem:
require File.expand_path(File.dirname(FILE) + '/spec_helper')
describe "Refresh Roaming Zone Set, so it represents all the Partners currently defined, not only those defined when the Roaming Zone set was created" do
plsql.execute("CREATE TABLE AA( A INTEGER)")
plsql.execute("CREATE TABLE BB( A INTEGER)")
plsql.execute("CREATE SYNONYM TEST_SYN FOR AA")
plsql.aa.insert(:a => 1)
puts plsql.select(:first, "select count(1) FROM TEST_SYN").values
plsql.execute("CREATE OR REPLACE SYNONYM TEST_SYN FOR BB");
it "should properly switch object references" do
plsql.select(:first, "select count(1) FROM TEST_SYN").values
.should == plsql.TEST_SYN.count
plsql.execute("DROP TABLE AA")
plsql.execute("DROP TABLE BB")
plsql.execute("DROP SYNONYM TEST_SYN")
You can reestablish connection to clear schema object cache - I migrated tests to RSpec 2 which has different semantics for top level before(:all) and after(:all) blocks and therefore moved connection creation to lower level before(:all) blocks where necessary.
But probably this method should be exposed publicly as well - just wondering if there is any other use case besides ruby-plsql own tests.