Permalink
Browse files

Bump version, clean up spec helper and console

  • Loading branch information...
1 parent 4510610 commit c148b64895e9417876433e0a4014f8120f9f152a @ernie ernie committed Aug 6, 2012
Showing with 82 additions and 78 deletions.
  1. +4 −0 CHANGELOG.md
  2. +1 −1 lib/squeel/version.rb
  3. +4 −2 spec/console.rb
  4. +3 −7 spec/spec_helper.rb
  5. +32 −0 spec/support/models.rb
  6. +38 −68 spec/support/schema.rb
View
@@ -1,3 +1,7 @@
+## 1.0.9 (2012-08-06)
+
+* Fix issue with duplication of order conditions in default_scope on AR 3.0.x
+
## 1.0.8 (2012-07-28)
* Fix an issue with properly casting values to column type when used
@@ -1,3 +1,3 @@
module Squeel
- VERSION = "1.0.8"
+ VERSION = "1.0.9"
end
View
@@ -3,9 +3,11 @@
require 'sham'
require 'faker'
-Dir[File.expand_path('../../spec/{helpers,support,blueprints}/*.rb', __FILE__)].each do |f|
+Dir[File.expand_path('../helpers/*.rb', __FILE__)].each do |f|
require f
end
+require File.expand_path('../support/schema.rb', __FILE__)
+require File.expand_path('../support/models.rb', __FILE__)
Sham.define do
name { Faker::Name.name }
@@ -17,7 +19,7 @@
object_name { Faker::Lorem.words(1).first }
end
-Schema.create
+Models.make
require 'squeel'
View
@@ -29,6 +29,8 @@ def call(name, start, finish, message_id, values)
Dir[File.expand_path('../helpers/*.rb', __FILE__)].each do |f|
require f
end
+require File.expand_path('../support/schema.rb', __FILE__)
+require File.expand_path('../support/models.rb', __FILE__)
Sham.define do
name { Faker::Name.name }
@@ -45,13 +47,7 @@ def call(name, start, finish, message_id, values)
puts '=' * 80
puts "Running specs against ActiveRecord #{ActiveRecord::VERSION::STRING} and ARel #{Arel::VERSION}..."
puts '=' * 80
- require File.expand_path('../support/schema.rb', __FILE__)
- Schema.create
- require File.expand_path('../support/models.rb', __FILE__)
- Dir[File.expand_path('../blueprints/*.rb', __FILE__)].each do |f|
- require f
- end
- Schema.make_spec_data
+ Models.make
end
config.before(:all) { Sham.reset(:before_all) }
config.before(:each) { Sham.reset(:before_each) }
@@ -65,3 +65,35 @@ class Tag < ActiveRecord::Base
class Note < ActiveRecord::Base
belongs_to :notable, :polymorphic => true
end
+
+Dir[File.expand_path('../../blueprints/*.rb', __FILE__)].each do |f|
+ require f
+end
+
+class Models
+ def self.make
+ 10.times do
+ person = Person.make
+ 2.times do
+ UnidentifiedObject.create(:person => person, :name => Sham.object_name)
+ end
+ Note.make(:notable => person)
+ 3.times do
+ article = Article.make(:person => person)
+ 3.times do
+ article.tags = [Tag.make, Tag.make, Tag.make]
+ end
+ Note.make(:notable => article)
+ 10.times do
+ Comment.make(:article => article)
+ end
+ end
+ 2.times do
+ Comment.make(:person => person)
+ end
+ end
+
+ Comment.make(:body => 'First post!', :article => Article.make(:title => 'Hello, world!'))
+ Comment.make(:body => 'Last post!', :article => Article.first, :person => Article.first.commenters.first)
+ end
+end
View
@@ -6,83 +6,53 @@
:database => ':memory:'
)
-module Schema
- def self.create
- ActiveRecord::Base.silence do
- ActiveRecord::Migration.verbose = false
-
- ActiveRecord::Schema.define do
- create_table :people, :force => true do |t|
- t.integer :parent_id
- t.string :name
- t.integer :salary
- end
-
- create_table :messages, :force => true do |t|
- t.integer :author_id
- t.integer :recipient_id
- end
-
- create_table :unidentified_objects, :id => false, :force => true do |t|
- t.integer :person_id
- t.string :name
- end
-
- create_table :articles, :force => true do |t|
- t.integer :person_id
- t.string :title
- t.text :body
- end
+ActiveRecord::Base.silence do
+ ActiveRecord::Migration.verbose = false
+
+ ActiveRecord::Schema.define do
+ create_table :people, :force => true do |t|
+ t.integer :parent_id
+ t.string :name
+ t.integer :salary
+ end
- create_table :comments, :force => true do |t|
- t.integer :article_id
- t.integer :person_id
- t.text :body
- end
+ create_table :messages, :force => true do |t|
+ t.integer :author_id
+ t.integer :recipient_id
+ end
- create_table :tags, :force => true do |t|
- t.string :name
- end
+ create_table :unidentified_objects, :id => false, :force => true do |t|
+ t.integer :person_id
+ t.string :name
+ end
- create_table :articles_tags, :force => true, :id => false do |t|
- t.integer :article_id
- t.integer :tag_id
- end
+ create_table :articles, :force => true do |t|
+ t.integer :person_id
+ t.string :title
+ t.text :body
+ end
- create_table :notes, :force => true do |t|
- t.integer :notable_id
- t.string :notable_type
- t.string :note
- end
+ create_table :comments, :force => true do |t|
+ t.integer :article_id
+ t.integer :person_id
+ t.text :body
+ end
- end
+ create_table :tags, :force => true do |t|
+ t.string :name
end
- def self.make_spec_data
- 10.times do
- person = Person.make
- 2.times do
- UnidentifiedObject.create(:person => person, :name => Sham.object_name)
- end
- Note.make(:notable => person)
- 3.times do
- article = Article.make(:person => person)
- 3.times do
- article.tags = [Tag.make, Tag.make, Tag.make]
- end
- Note.make(:notable => article)
- 10.times do
- Comment.make(:article => article)
- end
- end
- 2.times do
- Comment.make(:person => person)
- end
- end
+ create_table :articles_tags, :force => true, :id => false do |t|
+ t.integer :article_id
+ t.integer :tag_id
+ end
- Comment.make(:body => 'First post!', :article => Article.make(:title => 'Hello, world!'))
- Comment.make(:body => 'Last post!', :article => Article.first, :person => Article.first.commenters.first)
+ create_table :notes, :force => true do |t|
+ t.integer :notable_id
+ t.string :notable_type
+ t.string :note
end
end
end
+

0 comments on commit c148b64

Please sign in to comment.