Skip to content
This repository has been archived by the owner on May 18, 2018. It is now read-only.

Commit

Permalink
Updated specs
Browse files Browse the repository at this point in the history
  • Loading branch information
dim committed Oct 21, 2011
1 parent f70c383 commit 438fac2
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Expand Up @@ -2,3 +2,6 @@ rvm:
- 1.9.2
- 1.9.3
- ree
gemfile:
- Gemfile
- Gemfile.rails-3.0.x
2 changes: 0 additions & 2 deletions Gemfile.lock
Expand Up @@ -2,14 +2,12 @@ PATH
remote: .
specs:
constrainable (0.5.1)
abstract
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)

GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionpack (3.1.1)
activemodel (= 3.1.1)
activesupport (= 3.1.1)
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.rails-3.0.x
@@ -0,0 +1,5 @@
source "http://rubygems.org"

gemspec
gem "activerecord", "~> 3.0.0"
gem "activesupport", "~> 3.0.0"
84 changes: 84 additions & 0 deletions Gemfile.rails-3.0.x.lock
@@ -0,0 +1,84 @@
PATH
remote: .
specs:
constrainable (0.5.1)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)

GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionpack (3.0.10)
activemodel (= 3.0.10)
activesupport (= 3.0.10)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.1)
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.10)
activesupport (= 3.0.10)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.10)
activemodel (= 3.0.10)
activesupport (= 3.0.10)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activesupport (3.0.10)
arel (2.0.10)
builder (2.1.2)
diff-lcs (1.1.3)
erubis (2.6.6)
abstract (>= 1.0.0)
i18n (0.5.0)
json (1.6.1)
rack (1.2.4)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
railties (3.0.10)
actionpack (= 3.0.10)
activesupport (= 3.0.10)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.4)
rake (0.9.2)
rdoc (3.11)
json (~> 1.4)
rspec (2.7.0)
rspec-core (~> 2.7.0)
rspec-expectations (~> 2.7.0)
rspec-mocks (~> 2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.7.0)
rspec-rails (2.7.0)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.7.0)
shoulda-matchers (1.0.0.beta3)
sqlite3 (1.3.4)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
thor (0.14.6)
tzinfo (0.3.30)

PLATFORMS
ruby

DEPENDENCIES
actionpack
activerecord (~> 3.0.0)
activesupport (~> 3.0.0)
constrainable!
rspec
rspec-rails
shoulda-matchers
sqlite3-ruby
7 changes: 6 additions & 1 deletion constrainable.gemspec
Expand Up @@ -16,7 +16,12 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.files = Dir['LICENSE', 'README.markdown', 'lib/**/*']

s.add_dependency "abstract"
s.add_dependency "activerecord", ">= 3.0.0"
s.add_dependency "activesupport", ">= 3.0.0"

s.add_development_dependency "rspec"
s.add_development_dependency "rspec-rails"
s.add_development_dependency "sqlite3-ruby"
s.add_development_dependency "shoulda-matchers"
s.add_development_dependency "actionpack"
end
36 changes: 13 additions & 23 deletions spec/spec_helper.rb
Expand Up @@ -2,8 +2,7 @@

$: << File.dirname(__FILE__) + '/../lib'
require 'rubygems'
require 'bundler'
Bundler.setup
require 'bundler/setup'
Bundler.require :default, :test

require 'active_support'
Expand All @@ -15,32 +14,23 @@
require 'rspec/rails/fixture_support'
require 'bsm/constrainable'

SPEC_DATABASE = File.dirname(__FILE__) + '/tmp/test.sqlite3'
ActiveRecord::Base.time_zone_aware_attributes = true
ActiveRecord::Base.default_timezone = :utc
ActiveRecord::Base.configurations["test"] = { 'adapter' => 'sqlite3', 'database' => SPEC_DATABASE }
ActiveRecord::Base.configurations["test"] = { 'adapter' => 'sqlite3', 'database' => ":memory:" }
ActiveRecord::Base.establish_connection :test
ActiveRecord::Base.connection.create_table :posts do |t|
t.string :title
t.string :body
t.integer :author_id
t.string :category
t.timestamps
end
ActiveRecord::Base.connection.create_table :authors do |t|
t.string :name
end

RSpec.configure do |c|
c.fixture_path = File.dirname(__FILE__) + '/fixtures'
c.before(:all) do
FileUtils.mkdir_p File.dirname(SPEC_DATABASE)
base = ActiveRecord::Base
base.establish_connection(:test)
base.connection.create_table :posts do |t|
t.string :title
t.string :body
t.integer :author_id
t.string :category
t.timestamps
end
base.connection.create_table :authors do |t|
t.string :name
end
end

c.after(:all) do
FileUtils.rm_f(SPEC_DATABASE)
end
end

class String
Expand Down

0 comments on commit 438fac2

Please sign in to comment.