Permalink
Browse files

Merge pull request #3 from Senjai/master

Update to active record 4.0
  • Loading branch information...
2 parents 2244a72 + 6b92ef5 commit 7e78db0319ac190b649d9532ec7f1c4265a940a9 @radar committed Jan 15, 2014
Showing with 54 additions and 43 deletions.
  1. +1 −1 Gemfile
  2. +39 −31 Gemfile.lock
  3. +6 −3 lib/searcher.rb
  4. +1 −1 lib/searcher/version.rb
  5. +2 −2 searcher.gemspec
  6. BIN searcher.sqlite3
  7. +5 −5 spec/searcher_spec.rb
View
@@ -1,4 +1,4 @@
-source :gemcutter
+source 'https://rubygems.org'
group(:test) do
gem 'sqlite3-ruby'
View
@@ -1,45 +1,53 @@
PATH
remote: .
specs:
- searcher (0.0.3)
- activerecord (~> 3.0.0)
+ searcher (0.0.6)
+ activerecord (~> 4.0)
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
- activemodel (3.0.0)
- activesupport (= 3.0.0)
- builder (~> 2.1.2)
- i18n (~> 0.4.1)
- activerecord (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
- arel (~> 1.0.0)
- tzinfo (~> 0.3.23)
- activesupport (3.0.0)
- arel (1.0.1)
- activesupport (~> 3.0.0)
- builder (2.1.2)
- diff-lcs (1.1.2)
- i18n (0.4.1)
- rspec (2.0.0.beta.22)
- rspec-core (= 2.0.0.beta.22)
- rspec-expectations (= 2.0.0.beta.22)
- rspec-mocks (= 2.0.0.beta.22)
- rspec-core (2.0.0.beta.22)
- rspec-expectations (2.0.0.beta.22)
- diff-lcs (>= 1.1.2)
- rspec-mocks (2.0.0.beta.22)
- rspec-core (= 2.0.0.beta.22)
- rspec-expectations (= 2.0.0.beta.22)
- sqlite3-ruby (1.3.1)
- tzinfo (0.3.23)
+ activemodel (4.0.0)
+ activesupport (= 4.0.0)
+ builder (~> 3.1.0)
+ activerecord (4.0.0)
+ activemodel (= 4.0.0)
+ activerecord-deprecated_finders (~> 1.0.2)
+ activesupport (= 4.0.0)
+ arel (~> 4.0.0)
+ activerecord-deprecated_finders (1.0.3)
+ activesupport (4.0.0)
+ i18n (~> 0.6, >= 0.6.4)
+ minitest (~> 4.2)
+ multi_json (~> 1.3)
+ thread_safe (~> 0.1)
+ tzinfo (~> 0.3.37)
+ arel (4.0.0)
+ atomic (1.1.13)
+ builder (3.1.4)
+ diff-lcs (1.2.4)
+ i18n (0.6.5)
+ minitest (4.7.5)
+ multi_json (1.7.9)
+ rspec (2.14.1)
+ rspec-core (~> 2.14.0)
+ rspec-expectations (~> 2.14.0)
+ rspec-mocks (~> 2.14.0)
+ rspec-core (2.14.5)
+ rspec-expectations (2.14.2)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.14.3)
+ sqlite3 (1.3.8)
+ sqlite3-ruby (1.3.3)
+ sqlite3 (>= 1.3.3)
+ thread_safe (0.1.2)
+ atomic
+ tzinfo (0.3.37)
PLATFORMS
ruby
DEPENDENCIES
- activerecord (~> 3.0.0)
bundler (>= 1.0.0)
rspec
searcher!
View
@@ -2,16 +2,19 @@
require 'searcher/class_methods'
module Searcher
- mattr_accessor :classes
+ def self.classes=(klass_list)
+ @@classes = klass_list
+ end
+
def self.classes
- @classes ||= []
+ @@classes ||= []
end
end
ActiveRecord::Base.extend(Searcher::ClassMethods)
ActiveSupport.on_load(:after_initialize) do
- Dir[Rails.root + "app/models/**/*.rb"].each { |f| require f } if Rails.env.development?
+ Dir["/home/richard/projects/searcher-spec/" + "app/models/**/*.rb"].each { |f| require f }
Searcher.classes.each do |klass|
table = klass.arel_table
klass.searcher[:labels].each do |name, config|
View
@@ -1,3 +1,3 @@
module Searcher
- VERSION = "0.0.6"
+ VERSION = "0.0.7"
end
View
@@ -15,8 +15,8 @@ Gem::Specification.new do |s|
s.rubyforge_project = "searcher"
s.add_development_dependency "bundler", ">= 1.0.0"
-
- s.add_dependency "activerecord", "~> 3.0"
+
+ s.add_dependency "activerecord", "~> 4.0"
s.files = `git ls-files`.split("\n")
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
View
Binary file not shown.
View
@@ -3,25 +3,25 @@
describe Searcher do
let(:search_results) { subject }
let(:first_result) { subject.first }
-
- context "habtm label search" do
+
+ context "habtm label search" do
subject { Ticket.search("tag:bug") }
it "finds a ticket" do
first_result.description.should eql("Hello world! You are awesome.")
end
end
-
+
context "belongs_to label search" do
subject { Ticket.search("state:Open") }
it "finds a ticket" do
first_result.description.should eql("Hello world! You are awesome.")
end
end
-
+
context "undefined label search" do
subject { Ticket.search("undefined:true") }
it "returns all the records" do
- search_results.should eql(Ticket.all)
+ search_results.to_a.should eql(Ticket.all.to_a)
end
end
end

0 comments on commit 7e78db0

Please sign in to comment.