Skip to content

Commit

Permalink
fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
nofxx committed Jul 25, 2013
1 parent d7ebe06 commit 16512b0
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 51 deletions.
65 changes: 63 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,70 @@

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'i18n'


require 'i18n'
I18n.load_path += Dir[File.join(File.dirname(__FILE__), "locales", "*.{rb,yml}")]
I18n.default_locale = "pt"

if ENV["CI"]
require 'coveralls'
Coveralls.wear!
end

#
# Mongoid
#
unless ENV["ONLY_AR"]

require 'mongoid'
puts "Using Mongoid v#{Mongoid::VERSION}"

Mongoid.configure do |config|
#config.master = Mongo::Connection.new.db("symbolize_test")
config.connect_to('symbolize_test')
end

require 'symbolize/mongoid'

RSpec.configure do |config|
config.before(:each) do
Mongoid.purge!
end
end
end


#
# ActiveRecord
#
unless ENV["ONLY_MONGOID"]

require 'active_record'
require 'symbolize/active_record'

puts "Using ActiveRecord #{ActiveRecord::VERSION::STRING}"

ActiveRecord::Base.send :include, Symbolize::ActiveRecord # this is normally done by the railtie

ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") #'postgresql', :database => 'symbolize_test', :username => 'postgres')


if ActiveRecord::VERSION::STRING >= "3.1"
ActiveRecord::Migrator.migrate("spec/db")
else
require "db/001_create_testing_structure"
CreateTestingStructure.migrate(:up)
end


# Spec::Runner.configure do |config|
# end

RSpec.configure do |config|

config.after(:each) do
[User, Permission].each { |klass| klass.delete_all }
end

end
end
29 changes: 0 additions & 29 deletions spec/spec_helper_ar.rb

This file was deleted.

18 changes: 0 additions & 18 deletions spec/spec_helper_mongoid.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/symbolize/active_record_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
require File.dirname(__FILE__) + '/../spec_helper_ar'
require 'spec_helper'

#
# Test model
Expand Down
2 changes: 1 addition & 1 deletion spec/symbolize/mongoid_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
require 'spec_helper_mongoid'
require 'spec_helper'

#
# Test models
Expand Down

0 comments on commit 16512b0

Please sign in to comment.