Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Mar 1, 2011
2 parents e9fcb6f + a4b6e99 commit 995caa4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Gemfile
@@ -0,0 +1,10 @@
source :rubygems

gem 'jeweler'

gem 'activerecord', '>= 2.0.0'

group :test do
gem 'rspec', '1.3.1'
gem 'sqlite3-ruby'
end
7 changes: 4 additions & 3 deletions Rakefile
@@ -1,5 +1,8 @@
require 'rubygems' require 'rubygems'
require 'rake' require 'rake'
require 'bundler'

Bundler.setup


begin begin
require 'jeweler' require 'jeweler'
Expand All @@ -10,7 +13,7 @@ begin
gem.email = "bjohnson@binarylogic.com" gem.email = "bjohnson@binarylogic.com"
gem.homepage = "http://github.com/binarylogic/searchlogic" gem.homepage = "http://github.com/binarylogic/searchlogic"
gem.authors = ["Ben Johnson of Binary Logic"] gem.authors = ["Ben Johnson of Binary Logic"]
gem.add_dependency "activerecord", ">= 2.0.0" gem.add_bundler_dependencies
end end
Jeweler::GemcutterTasks.new Jeweler::GemcutterTasks.new
rescue LoadError rescue LoadError
Expand All @@ -29,6 +32,4 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
spec.rcov = true spec.rcov = true
end end


task :spec => :check_dependencies

task :default => :spec task :default => :spec
15 changes: 13 additions & 2 deletions spec/searchlogic/named_scopes/association_conditions_spec.rb
Expand Up @@ -158,7 +158,7 @@
User.named_scope(:orders_big_id, :joins => User.inner_joins(:orders)) User.named_scope(:orders_big_id, :joins => User.inner_joins(:orders))
Company.users_orders_big_id.proxy_options.should == {:joins=>[" INNER JOIN \"users\" ON users.company_id = companies.id ", " INNER JOIN \"orders\" ON orders.user_id = users.id "]} Company.users_orders_big_id.proxy_options.should == {:joins=>[" INNER JOIN \"users\" ON users.company_id = companies.id ", " INNER JOIN \"orders\" ON orders.user_id = users.id "]}
end end

it "should order the join statements ascending by the fieldnames so that we don't get double joins where the only difference is that the order of the fields is different" do it "should order the join statements ascending by the fieldnames so that we don't get double joins where the only difference is that the order of the fields is different" do
company = Company.create company = Company.create
user = company.users.create(:company_id => company.id) user = company.users.create(:company_id => company.id)
Expand Down Expand Up @@ -200,4 +200,15 @@


Company.users_id_equals_any([user2.id, user3.id]).all(:select => "DISTINCT companies.*").should == [company2] Company.users_id_equals_any([user2.id, user3.id]).all(:select => "DISTINCT companies.*").should == [company2]
end end
end
it "should allow dynamic scope generation on associations without losing association scope options" do
pending
user = User.create
Order.create :user => user, :shipped_on => Time.now
Order.create :shipped_on => Time.now
# The next line causes the assertion to fail
Order.named_scope :shipped_on_not_null, :conditions => ['shipped_on is not null']
user.orders.shipped_on_not_null.shipped_on_greater_than(2.days.ago).count.should == 1
end

end

0 comments on commit 995caa4

Please sign in to comment.