Sha256: 8af581a027f02f581918d2fccbf506f689e913275286a7f4d5b99a8850d0ae56

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'lib', 'firefly.rb')

require 'rubygems'
require "bundler/setup"

require 'sinatra'
require 'rack/test'
require 'spec'
require 'spec/autorun'
require 'spec/interop/test'
require 'yaml'

# set test environment
set :environment, :test
set :run, false
set :raise_errors, true
set :logging, false

@@app = Firefly::Server.new do
  set :hostname,        "test.host"
  set :api_key,         "test"
  set :database,        "mysql://root@localhost/firefly_test"

  set :sharing_key,     "asdfasdf"
  set :sharing_targets, [:twitter]
  set :sharing_domains, ["example.com", "example.net"]
end

Spec::Runner.configure do |config|
  config.after(:each) do
      repository do |r|
        adapter = r.adapter
        while adapter.current_transaction
          adapter.current_transaction.rollback
          adapter.pop_transaction
        end
      end
  end

  config.before(:each)  do
      repository do |r|
        transaction = DataMapper::Transaction.new(r)
        Firefly::CodeFactory.first.update(:count => 0)
        transaction.begin
        r.adapter.push_transaction(transaction)
      end
  end

  # Loads the urls.yml fixtures.
  def load_fixtures
    Firefly::Url.destroy
    urls = YAML::load(File.open('spec/fixtures/urls.yml'))
    urls.each { |key, url| Firefly::Url.create(url) }
  end

  # Load a spec file and return its contents
  def spec_file(filename)
    File.open('spec/files/'+filename) { |f| f.read }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
firefly-1.4.1 spec/spec_helper.rb
firefly-1.4.0 spec/spec_helper.rb