Sha256: 839d54dd9f9e94ebf5bb82850a4063e3c7cb531f846947ba6ed1eb3aab9d2d60
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
module Volt class << self def spec_setup(app_path = '.') require 'volt' ENV['SERVER'] = 'true' ENV['VOLT_ENV'] = 'test' require 'volt/boot' # Require in app Volt.boot(app_path) unless RUBY_PLATFORM == 'opal' begin require 'volt/spec/capybara' setup_capybara(app_path) rescue LoadError => e Volt.logger.warn("unable to load capybara, if you wish to use it for tests, be sure it is in the app's Gemfile") end end unless ENV['BROWSER'] # Not running integration tests with ENV['BROWSER'] RSpec.configuration.filter_run_excluding :type => :feature end # Setup the spec collection accessors # RSpec.shared_context "volt collections", {} do RSpec.shared_examples_for 'volt collections', {} do # Page conflicts with capybara's page method, so we call it the_page for now. # TODO: we need a better solution for page let(:the_page) { Model.new } let(:store) do @__store_accessed = true $page ||= Page.new $page.store end after do if @__store_accessed # Clear the database after each spec where we use store # @@db ||= Volt::DataStore.fetch # puts "DB CLASS: #{@@db.inspect}" # @@db.drop_database ::DataStore.new.drop_database $page.instance_variable_set('@store', nil) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
volt-0.9.0.pre6 | lib/volt/spec/setup.rb |
volt-0.9.0.pre5 | lib/volt/spec/setup.rb |
volt-0.9.0.pre4 | lib/volt/spec/setup.rb |