lib/postspec.rb in postspec-0.1.1 vs lib/postspec.rb in postspec-0.1.2
- old
+ new
@@ -38,10 +38,13 @@
# If true and a test case fails, postspec will commit all changes and
# ignore any further tests. If rspec is called with the --fail-fast option
# the test run will terminate immediately. Default true
attr_reader :fail
+ # List of ignored schemas
+ attr_reader :ignore
+
# State
attr_reader :state
# Map from UID to record ID of inserted, updated, and deleted records
forward_to :state, :inserted, :updated, :deleted
@@ -63,30 +66,31 @@
attr_reader :render
# TODO: PgMeta object
#
# +mode+ can be one of :seed, :empty (TODO :reseed, :keep)
- def initialize(conn, reflector: nil, mode: :empty, anchors: [], fail: true)
-# puts "Postspec#initialize"
+ def initialize(conn, reflector: nil, mode: :empty, anchors: [], fail: true, ignore: [])
constrain conn, PgConn
constrain reflector, NilClass, String, PgGraph::Reflector
constrain mode, lambda { |m| [:empty, :seed].include?(m) }
constrain anchors, [Hash], NilClass
constrain fail, TrueClass, FalseClass
+ constrain ignore, [String]
@conn = conn
@meta = PgMeta.new(@conn)
# Make sure the postspec schema is not included in the type model. TODO:
# Consolidate this into the :ignore option of PgGraph::Type.new as is
# done with the prick schema below
has_postspec = @meta.schemas.key?("postspec")
!has_postspec or (@meta.schemas["postspec"].hidden = true)
- @type = PgGraph::Type.new(@meta, reflector, ignore: ["prick"])
+ @type = PgGraph::Type.new(@meta, reflector, ignore: ["prick"] + ignore)
@render = Render.new(self)
@tables = type.schemas.map(&:tables).flatten
+ @ignore = ignore
@fail = fail
@failed = false
@success = true
# Compile-time state variable with the current search_path. Frames are
@@ -215,10 +219,9 @@
this.conn.execute(frame.pop_sql)
}
end
def use(rspec, *files)
-
# Closure variables
this = self
search_path = self.search_path
rspec.before(:all) {