Sha256: 3b9b7cbfbb25344da17bc351dabaf77edfa5dec09238ce7276a8639a668f46f7

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require "rspec"
require "monocle"

require "rails"
require "active_record"
require "database_cleaner"
require "shoulda-matchers"

ActiveRecord::Migration.verbose = false
ActiveRecord::Base.logger = Logger.new(nil)

ActiveRecord::Base.establish_connection(
  :adapter  => "sqlite3",
  :database => File.expand_path("spec/db/monocle.sqlite3"))

ActiveRecord::Migrator.migrate(File.expand_path("spec/db/migrate"))

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

def create_view(options = {})
  values = {
    :viewable_type => "Viewable",
    :viewable_id => 1,
    :viewed_on_start_date => Time.now - 10.days,
    :views => 10 }.merge(options)

  %w( Daily Weekly Monthly Yearly Overall ).each do |time_span|
    klass = "Monocle::#{time_span}View".constantize
    klass.create(values)
  end
end

RSpec.configure do |config|
  config.mock_with :mocha 

  config.after(:each) do
    DatabaseCleaner.strategy = :truncation
    DatabaseCleaner.clean
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
monocle-0.1.1 spec/spec_helper.rb
monocle-0.1.0 spec/spec_helper.rb
monocle-0.0.1 spec/spec_helper.rb