searchlight 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d87d47fdacfae5b1d8d87d2c34b6443610fb4f88
4
- data.tar.gz: 639cb63efe19379336e0fbcd65b8d66f0d265f2a
3
+ metadata.gz: 6535dc6c570b01a67e7a25a51819bd57c155abb5
4
+ data.tar.gz: 6741f5d2dd6a1bc93641263848b926662df22307
5
5
  SHA512:
6
- metadata.gz: 9785b92c697fb59b0ae3aebd88af3f1913c04df0ff99aed3b73923b13d2d313d9923f98b217a7646be742c163ab892d61ce3eb8cff77960da21a132979a1717d
7
- data.tar.gz: 5438b35af95bcf804ff0898f8989f0d804f7bb1b46f9f74642e59d3a98c5a27ac70c681a988b8ffca545aa9253a9339b3f3efca9fe29e7beaca868b70b0d73df
6
+ metadata.gz: 06768634ad235bb9b45fe93ceaf2f5d1a07fcfc016f396d1fa70b727721ac802ac8956869bcc2715539b413f6b22126e614a9042277b2bfe04c80af213d2fe9f
7
+ data.tar.gz: 4350283762d804a7c1747b49815598f5b17eddd28ca8ee591ad0857ace1f578099d57d8e1f517d03cacbaf18cda126ab04e1a6d37eeb2eb5d7636cfa028f74a6
@@ -2,6 +2,14 @@
2
2
 
3
3
  Searchlight does its best to use [semantic versioning](http://semver.org).
4
4
 
5
+ ## v3.0.0
6
+
7
+ Two major releases in two days!? Well, I thought of another good, but breaking, change. To the major version bump, Robin!
8
+
9
+ Inputs generated using `ActionView` forms are now named after your search form. Eg, the form for 'UserSearch' will submit parameters under 'user_search', not just 'search'. This makes the code more standard and namespaces the form, in case, eg, you want to have two forms on the same page.
10
+
11
+ Note that to upgrade, Rails users will need to change references to `params[:search]` to something like `params[:user_search]` (depending on name of the search class).
12
+
5
13
  ## v2.0.0
6
14
 
7
15
  Now with fewer features! :D
data/TODO.md CHANGED
@@ -1,7 +1,4 @@
1
1
  # TODO
2
2
 
3
- - Only have `options` method return values that map to search methods; it doesn't track any `attr_accessor` you may have. This guarantees consistent contents.
4
- - Run rcov and mutant
3
+ - Do some mutation testing
5
4
  - Make nice Github page
6
- - Test with ActiveRecord 4
7
- - Add more complex example searches to show where Searchlight shines. Eg: for a given disease, find people who've traveled in a given time period and visited countries that had an outbreak of that disease during their visit.
@@ -7,4 +7,6 @@ end
7
7
 
8
8
  require 'searchlight/dsl'
9
9
  require 'searchlight/search'
10
- require 'searchlight/adapters/action_view' if defined?(::ActionView)
10
+ if defined?(::ActionView) && defined?(::ActiveModel)
11
+ require 'searchlight/adapters/action_view'
12
+ end
@@ -1,30 +1,23 @@
1
+ require 'action_view'
2
+ require 'active_model'
3
+ require 'active_support/core_ext'
4
+
1
5
  module Searchlight
2
6
  module Adapters
3
7
  module ActionView
4
8
 
5
- module ClassMethods
6
-
7
- def model_name
8
- ::ActiveModel::Name.new(self, nil, 'search')
9
- end
9
+ include ::ActiveModel::Conversion
10
10
 
11
+ def self.included(target)
12
+ target.extend ::ActiveModel::Naming
11
13
  end
12
14
 
13
- module InstanceMethods
14
-
15
- def to_key
16
- []
17
- end
18
-
19
- def persisted?
20
- false
21
- end
22
-
15
+ def persisted?
16
+ false
23
17
  end
24
18
 
25
19
  end
26
20
  end
27
21
  end
28
22
 
29
- Searchlight::Search.send(:include, Searchlight::Adapters::ActionView::InstanceMethods)
30
- Searchlight::Search.extend(Searchlight::Adapters::ActionView::ClassMethods)
23
+ Searchlight::Search.send(:include, Searchlight::Adapters::ActionView)
@@ -1,3 +1,3 @@
1
1
  module Searchlight
2
- VERSION = "2.0.0"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -6,10 +6,8 @@ describe 'Searchlight::Adapters::ActionView', type: :feature, adapter: true do
6
6
  let(:search) { AccountSearch.new(paid_amount: 15) }
7
7
 
8
8
  before :all do
9
+ # Only required when running these tests
9
10
  require 'searchlight/adapters/action_view'
10
- require 'action_view'
11
- require 'active_model'
12
- require 'active_support/core_ext'
13
11
  end
14
12
 
15
13
  before :each do
@@ -21,7 +19,7 @@ describe 'Searchlight::Adapters::ActionView', type: :feature, adapter: true do
21
19
  f.text_field(:paid_amount)
22
20
  end
23
21
 
24
- expect(form).to have_selector("form input[name='search[paid_amount]'][value='15']")
22
+ expect(form).to have_selector("form input[name='account_search[paid_amount]'][value='15']")
25
23
  end
26
24
 
27
25
  it "tells the form that it is not persisted" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Long
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-14 00:00:00.000000000 Z
12
+ date: 2014-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: named