Sha256: e83c67311ff53219e4abd29712580df6f8bb0255c07b6e7eaf3b6884fba471ff

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

# Set up activerecord & in-memory SQLite DB
require 'active_record'
require 'sqlite3'
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"

# Uncomment to enable SQL logging during tests for debugging
# require 'logger'
# ActiveRecord::Base.logger = Logger.new(STDOUT)

# Require our library
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'iron', 'settings'))

# Run our migration to add DB value models to test DB
require_relative('../db/settings_migration')
SettingsMigration.migrate(:up)

# Run migration to create test model to use as settings owner
ActiveRecord::Migration.create_table :test_models do |t|
  t.string 'name'
end

# Create test model class
class TestModel < ActiveRecord::Base
  instance_settings do
    int('some_num', 5)
    int('no_default')
    group('some_group') do
      string('some_string')
      group('subgrouper') do
        symbol('yo', :baby)
      end
    end
  end
end

# Config RSpec options
RSpec.configure do |config|
  config.color = true
  config.add_formatter 'documentation'
  config.backtrace_exclusion_patterns = [/rspec/]
end

module SpecHelper
  
  # Helper to find sample file paths
  def self.sample_path(file)
    File.expand_path(File.join(File.dirname(__FILE__), 'samples', file))
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iron-settings-1.0.3 spec/spec_helper.rb
iron-settings-1.0.2 spec/spec_helper.rb