scoped_from 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 60b1498cb3cb9245b530983e03de6747afc745ae
4
+ data.tar.gz: de5a35a889949ab68cab01190a2621e2eb1617b9
5
+ SHA512:
6
+ metadata.gz: 23769faa9d0b74681da6d8be60a0c9768519c3a08871a68f73725f4b18763b292471669022b2be4e6001d73e106c47d9a1ea88b7e69cb089413a14aa74c31e1a
7
+ data.tar.gz: 204779901e30475f4dfc0adc59f5ec4eb7719944d5aff87aeca19b92ec6a602c84643145d3b2d6b2ee470ab2bf15fa9f2ac72034bbc77da36117fdac203a4d3c
data/.gitignore CHANGED
@@ -1,5 +1,5 @@
1
1
  .DS_Store
2
2
  .bundle
3
- .rbenv-version
3
+ .ruby-version
4
4
  pkg/*
5
5
  spec/test.sqlite3
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --colour
2
- --format progress
2
+ --order random
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
data/Gemfile.lock CHANGED
@@ -1,89 +1,54 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- scoped_from (0.6.1)
4
+ scoped_from (0.7.0)
5
5
  activerecord (~> 3.2.0)
6
6
  activesupport (~> 3.2.0)
7
7
 
8
8
  GEM
9
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (3.2.3)
12
- activemodel (= 3.2.3)
13
- activesupport (= 3.2.3)
11
+ activemodel (3.2.13)
12
+ activesupport (= 3.2.13)
14
13
  builder (~> 3.0.0)
15
- erubis (~> 2.7.0)
16
- journey (~> 1.0.1)
17
- rack (~> 1.4.0)
18
- rack-cache (~> 1.2)
19
- rack-test (~> 0.6.1)
20
- sprockets (~> 2.1.2)
21
- activemodel (3.2.3)
22
- activesupport (= 3.2.3)
23
- builder (~> 3.0.0)
24
- activerecord (3.2.3)
25
- activemodel (= 3.2.3)
26
- activesupport (= 3.2.3)
14
+ activerecord (3.2.13)
15
+ activemodel (= 3.2.13)
16
+ activesupport (= 3.2.13)
27
17
  arel (~> 3.0.2)
28
18
  tzinfo (~> 0.3.29)
29
- activesupport (3.2.3)
30
- i18n (~> 0.6)
19
+ activesupport (3.2.13)
20
+ i18n (= 0.6.1)
31
21
  multi_json (~> 1.0)
32
22
  arel (3.0.2)
33
- builder (3.0.0)
34
- diff-lcs (1.1.3)
35
- erubis (2.7.0)
36
- hike (1.2.1)
37
- i18n (0.6.0)
38
- journey (1.0.3)
39
- json (1.7.1)
40
- multi_json (1.3.4)
41
- rack (1.4.1)
42
- rack-cache (1.2)
43
- rack (>= 0.4)
44
- rack-ssl (1.3.2)
45
- rack
46
- rack-test (0.6.1)
47
- rack (>= 1.0)
48
- railties (3.2.3)
49
- actionpack (= 3.2.3)
50
- activesupport (= 3.2.3)
51
- rack-ssl (~> 1.3.2)
52
- rake (>= 0.8.7)
53
- rdoc (~> 3.4)
54
- thor (~> 0.14.6)
55
- rake (0.9.2.2)
56
- rdoc (3.12)
57
- json (~> 1.4)
58
- rspec (2.10.0)
59
- rspec-core (~> 2.10.0)
60
- rspec-expectations (~> 2.10.0)
61
- rspec-mocks (~> 2.10.0)
62
- rspec-core (2.10.0)
63
- rspec-expectations (2.10.0)
64
- diff-lcs (~> 1.1.3)
65
- rspec-mocks (2.10.1)
66
- rspec-rails (2.10.1)
67
- actionpack (>= 3.0)
68
- activesupport (>= 3.0)
69
- railties (>= 3.0)
70
- rspec (~> 2.10.0)
71
- sprockets (2.1.3)
72
- hike (~> 1.2)
73
- rack (~> 1.0)
74
- tilt (~> 1.1, != 1.3.0)
75
- sqlite3 (1.3.6)
23
+ builder (3.0.4)
24
+ byebug (1.6.1)
25
+ columnize (~> 0.3.6)
26
+ debugger-linecache (~> 1.2.0)
27
+ columnize (0.3.6)
28
+ debugger-linecache (1.2.0)
29
+ diff-lcs (1.2.4)
30
+ i18n (0.6.1)
31
+ multi_json (1.7.7)
32
+ rake (10.0.4)
33
+ rspec (2.14.1)
34
+ rspec-core (~> 2.14.0)
35
+ rspec-expectations (~> 2.14.0)
36
+ rspec-mocks (~> 2.14.0)
37
+ rspec-core (2.14.3)
38
+ rspec-expectations (2.14.0)
39
+ diff-lcs (>= 1.1.3, < 2.0)
40
+ rspec-mocks (2.14.1)
41
+ sqlite3 (1.3.7)
76
42
  sqlite3-ruby (1.3.3)
77
43
  sqlite3 (>= 1.3.3)
78
- thor (0.14.6)
79
- tilt (1.3.3)
80
- tzinfo (0.3.33)
44
+ tzinfo (0.3.37)
81
45
 
82
46
  PLATFORMS
83
47
  ruby
84
48
 
85
49
  DEPENDENCIES
86
- rspec (~> 2.10.0)
87
- rspec-rails (~> 2.10.0)
50
+ byebug (~> 1.6.0)
51
+ rake (~> 10.0.0)
52
+ rspec (~> 2.14.0)
88
53
  scoped_from!
89
- sqlite3-ruby
54
+ sqlite3-ruby (~> 1.3.0)
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rspec/core/rake_task'
4
4
  Bundler::GemHelper.install_tasks
5
5
 
6
6
  desc 'Default: runs specs.'
7
- task :default => :spec
7
+ task default: :spec
8
8
 
9
9
  desc 'Run all specs in spec directory.'
10
10
  RSpec::Core::RakeTask.new(:spec)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.7.0
@@ -2,9 +2,9 @@ module ScopedFrom
2
2
 
3
3
  class Query
4
4
 
5
- FALSE_VALUES = %w( false no n off 0 ).freeze
6
- ORDER_DIRECTIONS = %w( asc desc ).freeze
7
- TRUE_VALUES = %w( true yes y on 1 ).freeze
5
+ FALSE_VALUES = %w(false no n off 0).freeze
6
+ ORDER_DIRECTIONS = %w(asc desc).freeze
7
+ TRUE_VALUES = %w(true yes y on 1).freeze
8
8
 
9
9
  attr_reader :params
10
10
 
@@ -87,7 +87,7 @@ module ScopedFrom
87
87
  column, direction = value.to_s.split(/[\.:\s]+/, 2)
88
88
  direction = direction.to_s.downcase
89
89
  direction = ORDER_DIRECTIONS.first unless ORDER_DIRECTIONS.include?(direction)
90
- @scope.column_names.include?(column) ? { :column => column, :direction => direction } : {}
90
+ @scope.column_names.include?(column) ? { column: column, direction: direction } : {}
91
91
  end
92
92
 
93
93
  def parse_orders(values)
@@ -107,7 +107,7 @@ module ScopedFrom
107
107
  elsif scope.scope_without_argument?(name)
108
108
  scope.send(name)
109
109
  elsif scope.column_names.include?(name.to_s)
110
- scope.scoped(:conditions => { name => value })
110
+ scope.scoped(conditions: { name => value })
111
111
  else
112
112
  scope
113
113
  end
data/lib/scoped_from.rb CHANGED
@@ -7,17 +7,13 @@ require 'active_support/core_ext/object/to_query'
7
7
 
8
8
  module ScopedFrom
9
9
 
10
- class << self
11
-
12
- def version
13
- @@version ||= File.read(File.expand_path(File.dirname(__FILE__) + '/../VERSION')).strip.freeze
14
- end
15
-
10
+ def self.version
11
+ @@version ||= File.read(File.expand_path("#{__dir__}/../VERSION")).strip.freeze
16
12
  end
17
13
 
18
14
  end
19
15
 
20
- lib_path = File.expand_path(File.dirname(__FILE__) + '/scoped_from')
16
+ lib_path = "#{__dir__}/scoped_from"
21
17
 
22
18
  require "#{lib_path}/active_record"
23
19
  require "#{lib_path}/query"
data/scoped_from.gemspec CHANGED
@@ -18,7 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'activerecord', '~> 3.2.0'
19
19
  s.add_dependency 'activesupport', '~> 3.2.0'
20
20
 
21
- s.add_development_dependency 'rspec', '~> 2.10.0'
22
- s.add_development_dependency 'rspec-rails', '~> 2.10.0'
23
- s.add_development_dependency 'sqlite3-ruby'
21
+ s.add_development_dependency 'byebug', '~> 1.6.0'
22
+ s.add_development_dependency 'rake', '~> 10.0.0'
23
+ s.add_development_dependency 'rspec', '~> 2.14.0'
24
+ s.add_development_dependency 'sqlite3-ruby', '~> 1.3.0'
24
25
  end
data/spec/mocks/user.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class User < ActiveRecord::Base
2
2
 
3
- scope :enabled, where(:enabled => true)
3
+ scope :enabled, where(enabled: true)
4
4
  scope :search, lambda { |pattern|
5
5
  where('firstname LIKE ? OR lastname LIKE ?', "%#{pattern}%", "%#{pattern}%")
6
6
  }
@@ -63,25 +63,25 @@ describe ScopedFrom::ActiveRecord do
63
63
  describe '#scoped_from' do
64
64
 
65
65
  it 'just build a new query and return its scope' do
66
- query = mock(:query)
66
+ query = double(:query)
67
67
  query.should_receive(:scope).and_return(42)
68
- ScopedFrom::Query.should_receive(:new).with(User, 'foo', :except => 'bam').and_return(query)
69
- User.scoped_from('foo', :except => 'bam').should == 42
68
+ ScopedFrom::Query.should_receive(:new).with(User, 'foo', except: 'bam').and_return(query)
69
+ User.scoped_from('foo', except: 'bam').should == 42
70
70
  end
71
71
 
72
72
  it 'build scopes' do
73
- User.scoped_from(:search => 'jane').should == [users(:jane)]
74
- User.scoped_from(:search => 'john').should == [users(:john)]
73
+ User.scoped_from(search: 'jane').should == [users(:jane)]
74
+ User.scoped_from(search: 'john').should == [users(:john)]
75
75
  end
76
76
 
77
77
  it 'can be chained with other scopes' do
78
- User.scoped_from(:search => 'jane').should == [users(:jane)]
79
- User.enabled.scoped_from(:search => 'jane').should == []
78
+ User.scoped_from(search: 'jane').should == [users(:jane)]
79
+ User.enabled.scoped_from(search: 'jane').should == []
80
80
  end
81
81
 
82
82
  it 'can be used with order as parameter' do
83
- User.scoped_from(:order => 'firstname').first.should == users(:jane)
84
- User.scoped_from(:order => 'firstname.desc').first.should == users(:john)
83
+ User.scoped_from(order: 'firstname').first.should == users(:jane)
84
+ User.scoped_from(order: 'firstname.desc').first.should == users(:john)
85
85
  end
86
86
 
87
87
  it 'builds a ScopedFrom::Query' do
@@ -98,7 +98,7 @@ describe ScopedFrom::ActiveRecord do
98
98
 
99
99
  it 'builds a #{Class}Query if #{RecordClassName}Query is defined and is a ScopedFrom::Query' do
100
100
  Comment.scoped_from({}).query.class.should be(CommentQuery)
101
- Comment.where(:foo => 'bar').scoped_from({}).query.class.should be(CommentQuery)
101
+ Comment.where(foo: 'bar').scoped_from({}).query.class.should be(CommentQuery)
102
102
  CommentQuery.should be_a(Class)
103
103
  CommentQuery.ancestors.should include(ScopedFrom::Query)
104
104
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'spec_helper'
4
2
 
5
3
  describe ScopedFrom::Query do
@@ -75,16 +73,16 @@ describe ScopedFrom::Query do
75
73
  describe '#order_column' do
76
74
 
77
75
  it 'is column specified into "order" parameter' do
78
- query(User, :order => 'firstname').order_column.should == 'firstname'
79
- query(User, :order => 'lastname.desc').order_column.should == 'lastname'
76
+ query(User, order: 'firstname').order_column.should == 'firstname'
77
+ query(User, order: 'lastname.desc').order_column.should == 'lastname'
80
78
  end
81
79
 
82
80
  it 'is nil if column does not exist' do
83
- query(User, :order => 'foo').order_column.should be_nil
81
+ query(User, order: 'foo').order_column.should be_nil
84
82
  end
85
83
 
86
84
  it 'is nil if "order" param is not specified' do
87
- query(User, :search => 'foo').order_column.should be_nil
85
+ query(User, search: 'foo').order_column.should be_nil
88
86
  end
89
87
 
90
88
  end
@@ -92,29 +90,29 @@ describe ScopedFrom::Query do
92
90
  describe '#order_direction' do
93
91
 
94
92
  it 'is direction specified into "order" parameter' do
95
- query(User, :order => 'firstname.asc').order_direction.should == 'asc'
96
- query(User, :order => 'firstname.desc').order_direction.should == 'desc'
93
+ query(User, order: 'firstname.asc').order_direction.should == 'asc'
94
+ query(User, order: 'firstname.desc').order_direction.should == 'desc'
97
95
  end
98
96
 
99
97
  it 'is "asc" if direction is not specified' do
100
- query(User, :order => 'firstname').order_direction.should == 'asc'
98
+ query(User, order: 'firstname').order_direction.should == 'asc'
101
99
  end
102
100
 
103
101
  it 'is "asc" if direction is invalid' do
104
- query(User, :order => 'firstname.foo').order_direction.should == 'asc'
102
+ query(User, order: 'firstname.foo').order_direction.should == 'asc'
105
103
  end
106
104
 
107
105
  it 'is direction even specified in another case' do
108
- query(User, :order => 'firstname.ASc').order_direction.should == 'asc'
109
- query(User, :order => 'firstname.DeSC').order_direction.should == 'desc'
106
+ query(User, order: 'firstname.ASc').order_direction.should == 'asc'
107
+ query(User, order: 'firstname.DeSC').order_direction.should == 'desc'
110
108
  end
111
109
 
112
110
  it 'is nil if column does not exist' do
113
- query(User, :order => 'foo.desc').order_direction.should be_nil
111
+ query(User, order: 'foo.desc').order_direction.should be_nil
114
112
  end
115
113
 
116
114
  it 'is nil if "order" param is not specified' do
117
- query(User, :search => 'foo').order_direction.should be_nil
115
+ query(User, search: 'foo').order_direction.should be_nil
118
116
  end
119
117
 
120
118
  end
@@ -164,7 +162,7 @@ describe ScopedFrom::Query do
164
162
  end
165
163
 
166
164
  it 'can have multiple values (from hash)' do
167
- query(User, :search => ['bar', 'baz']).params.should == { 'search' => ['bar', 'baz'] }
165
+ query(User, search: ['bar', 'baz']).params.should == { 'search' => ['bar', 'baz'] }
168
166
  end
169
167
 
170
168
  it 'can have multiple values (from query string)' do
@@ -172,65 +170,65 @@ describe ScopedFrom::Query do
172
170
  end
173
171
 
174
172
  it 'converts value to true (or remove it) if scope takes no argument' do
175
- query(User, :latest => 'y').params.should == { 'latest' => true }
176
- query(User, :latest => 'no').params.should == {}
173
+ query(User, latest: 'y').params.should == { 'latest' => true }
174
+ query(User, latest: 'no').params.should == {}
177
175
  end
178
176
 
179
177
  it 'converts value to true (or false) if column is a boolean one' do
180
- query(User, :admin => 'y').params.should == { 'admin' => true }
181
- query(User, :admin => 'False').params.should == { 'admin' => false }
182
- query(User, :admin => 'bar').params.should == {}
183
- query(User, :admin => ['y', false]).params.should == {}
178
+ query(User, admin: 'y').params.should == { 'admin' => true }
179
+ query(User, admin: 'False').params.should == { 'admin' => false }
180
+ query(User, admin: 'bar').params.should == {}
181
+ query(User, admin: ['y', false]).params.should == {}
184
182
  end
185
183
 
186
184
  it 'converts array value to true (or remove it) if scope takes no argument' do
187
- query(User, :latest => true).params.should == { 'latest' => true }
188
- query(User, :latest => ['Yes']).params.should == { 'latest' => true }
189
- query(User, :latest => ['no', 'yes']).params.should == {}
190
- query(User, :latest => ['no', nil]).params.should == {}
191
- query(User, :latest => ['fo']).params.should == {}
185
+ query(User, latest: true).params.should == { 'latest' => true }
186
+ query(User, latest: ['Yes']).params.should == { 'latest' => true }
187
+ query(User, latest: ['no', 'yes']).params.should == {}
188
+ query(User, latest: ['no', nil]).params.should == {}
189
+ query(User, latest: ['fo']).params.should == {}
192
190
  end
193
191
 
194
192
  it 'flats array' do
195
- query(User, :search => [nil, ['bar', '', 'foo', ["\n ", 'baz']]]).params.should == { 'search' => [nil, 'bar', '', 'foo', "\n ", 'baz'] }
193
+ query(User, search: [nil, ['bar', '', 'foo', ["\n ", 'baz']]]).params.should == { 'search' => [nil, 'bar', '', 'foo', "\n ", 'baz'] }
196
194
  end
197
195
 
198
196
  it 'change array with a single value in one value' do
199
- query(User, :search => ['bar']).params.should == { 'search' => 'bar' }
197
+ query(User, search: ['bar']).params.should == { 'search' => 'bar' }
200
198
  end
201
199
 
202
200
  it 'does not modify given hash' do
203
- hash = { :search => 'foo', :enabled => '1', :bar => 'foo' }
201
+ hash = { search: 'foo', enabled: '1', bar: 'foo' }
204
202
  query(User, hash)
205
- hash.should == { :search => 'foo', :enabled => '1', :bar => 'foo' }
203
+ hash.should == { search: 'foo', enabled: '1', bar: 'foo' }
206
204
  end
207
205
 
208
206
  it 'does not modify given array' do
209
207
  items = ['bar', 'foo', nil]
210
- query(User, :search => items)
208
+ query(User, search: items)
211
209
  items.should == ['bar', 'foo', nil]
212
210
  end
213
211
 
214
212
  it 'accepts :only option' do
215
- query(User, { :search => 'bar', :enabled => 'true' }, :only => [:search]).params.should == { 'search' => 'bar' }
216
- query(User, { :search => 'bar', :enabled => 'true' }, :only => 'search').params.should == { 'search' => 'bar' }
217
- query(User, { :search => 'bar', :firstname => 'Jane', :enabled => 'true' }, :only => 'search').params.should == { 'search' => 'bar' }
218
- query(User, { :search => 'bar', :firstname => 'Jane', :enabled => 'true' }, :only => ['search', :firstname]).params.should == { 'search' => 'bar', 'firstname' => 'Jane' }
213
+ query(User, { search: 'bar', enabled: 'true' }, only: [:search]).params.should == { 'search' => 'bar' }
214
+ query(User, { search: 'bar', enabled: 'true' }, only: 'search').params.should == { 'search' => 'bar' }
215
+ query(User, { search: 'bar', firstname: 'Jane', enabled: 'true' }, only: 'search').params.should == { 'search' => 'bar' }
216
+ query(User, { search: 'bar', firstname: 'Jane', enabled: 'true' }, only: ['search', :firstname]).params.should == { 'search' => 'bar', 'firstname' => 'Jane' }
219
217
  end
220
218
 
221
219
  it 'accepts :except option' do
222
- query(User, { :search => 'bar', :enabled => true }, :except => [:search]).params.should == { 'enabled' => true }
223
- query(User, { :search => 'bar', :enabled => true }, :except => 'search').params.should == { 'enabled' => true }
224
- query(User, { :search => 'bar', :firstname => 'Jane', :enabled => true }, :except => 'search').params.should == { 'enabled' => true, 'firstname' => 'Jane' }
225
- query(User, { :search => 'bar', :firstname => 'Jane', :enabled => true }, :except => ['search', :firstname]).params.should == { 'enabled' => true }
220
+ query(User, { search: 'bar', enabled: true }, except: [:search]).params.should == { 'enabled' => true }
221
+ query(User, { search: 'bar', enabled: true }, except: 'search').params.should == { 'enabled' => true }
222
+ query(User, { search: 'bar', firstname: 'Jane', enabled: true }, except: 'search').params.should == { 'enabled' => true, 'firstname' => 'Jane' }
223
+ query(User, { search: 'bar', firstname: 'Jane', enabled: true }, except: ['search', :firstname]).params.should == { 'enabled' => true }
226
224
  end
227
225
 
228
226
  it 'accepts a query instance' do
229
- query(User, query(User, :search => 'toto')).params.should == { 'search' => 'toto' }
227
+ query(User, query(User, search: 'toto')).params.should == { 'search' => 'toto' }
230
228
  end
231
229
 
232
230
  it 'preserve blank values' do
233
- query(User, { :search => "\n ", 'enabled' => true }).params.should == { 'search' => "\n ", 'enabled' => true }
231
+ query(User, { search: "\n ", 'enabled' => true }).params.should == { 'search' => "\n ", 'enabled' => true }
234
232
  end
235
233
 
236
234
  it 'preserve blank values from array' do
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  ENV["RAILS_ENV"] ||= 'test'
2
2
 
3
- require File.dirname(__FILE__) + '/../lib/scoped_from'
3
+ require File.expand_path("#{__dir__}/../lib/scoped_from")
4
4
 
5
5
  # Support
6
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
6
+ Dir["#{__dir__}/support/**/*.rb"].each { |f| require File.expand_path(f) }
7
7
 
8
8
  # Mocks
9
- ActiveSupport::Dependencies.autoload_paths << "#{File.dirname(__FILE__)}/mocks"
9
+ ActiveSupport::Dependencies.autoload_paths << "#{__dir__}/mocks"
10
10
 
11
11
  RSpec.configure do |config|
12
12
  config.include(UserMacro)
@@ -17,7 +17,7 @@ RSpec.configure do |config|
17
17
  User.delete_all
18
18
  Vote.delete_all
19
19
 
20
- create_user(:john, :firstname => 'John', :lastname => 'Doe', :enabled => true, :admin => true)
21
- create_user(:jane, :firstname => 'Jane', :lastname => 'Doe', :enabled => false, :admin => false)
20
+ create_user(:john, firstname: 'John', lastname: 'Doe', enabled: true, admin: true)
21
+ create_user(:jane, firstname: 'Jane', lastname: 'Doe', enabled: false, admin: false)
22
22
  end
23
23
  end
@@ -1,12 +1,12 @@
1
- ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => "#{File.dirname(__FILE__)}/../../test.sqlite3", :timeout => 5000)
1
+ ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: File.expand_path("#{__dir__}/../../test.sqlite3"), timeout: 5000)
2
2
 
3
- ActiveRecord::Base.connection.create_table(:comments, :force => true)
4
- ActiveRecord::Base.connection.create_table(:posts, :force => true)
5
- ActiveRecord::Base.connection.create_table(:users, :force => true) do |t|
6
- t.string :firstname, :null => false
7
- t.string :lastname, :null => false
8
- t.boolean :enabled, :null => false, :default => false
9
- t.boolean :admin, :null => false, :default => false
3
+ ActiveRecord::Base.connection.create_table(:comments, force: true)
4
+ ActiveRecord::Base.connection.create_table(:posts, force: true)
5
+ ActiveRecord::Base.connection.create_table(:users, force: true) do |t|
6
+ t.string :firstname, null: false
7
+ t.string :lastname, null: false
8
+ t.boolean :enabled, null: false, default: false
9
+ t.boolean :admin, null: false, default: false
10
10
  t.timestamps
11
11
  end
12
- ActiveRecord::Base.connection.create_table(:votes, :force => true)
12
+ ActiveRecord::Base.connection.create_table(:votes, force: true)
metadata CHANGED
@@ -1,71 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoped_from
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
5
- prerelease:
4
+ version: 0.7.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alexis Toulotte
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-10 00:00:00.000000000 Z
11
+ date: 2013-07-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
- requirement: &70282866988720 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
19
  version: 3.2.0
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70282866988720
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.0
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: activesupport
27
- requirement: &70282866987480 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ~>
31
32
  - !ruby/object:Gem::Version
32
33
  version: 3.2.0
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70282866987480
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 3.2.0
36
41
  - !ruby/object:Gem::Dependency
37
- name: rspec
38
- requirement: &70282866986780 !ruby/object:Gem::Requirement
39
- none: false
42
+ name: byebug
43
+ requirement: !ruby/object:Gem::Requirement
40
44
  requirements:
41
45
  - - ~>
42
46
  - !ruby/object:Gem::Version
43
- version: 2.10.0
47
+ version: 1.6.0
44
48
  type: :development
45
49
  prerelease: false
46
- version_requirements: *70282866986780
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.0
47
55
  - !ruby/object:Gem::Dependency
48
- name: rspec-rails
49
- requirement: &70282867000940 !ruby/object:Gem::Requirement
50
- none: false
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
51
58
  requirements:
52
59
  - - ~>
53
60
  - !ruby/object:Gem::Version
54
- version: 2.10.0
61
+ version: 10.0.0
55
62
  type: :development
56
63
  prerelease: false
57
- version_requirements: *70282867000940
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 10.0.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.14.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.14.0
58
83
  - !ruby/object:Gem::Dependency
59
84
  name: sqlite3-ruby
60
- requirement: &70282867000520 !ruby/object:Gem::Requirement
61
- none: false
85
+ requirement: !ruby/object:Gem::Requirement
62
86
  requirements:
63
- - - ! '>='
87
+ - - ~>
64
88
  - !ruby/object:Gem::Version
65
- version: '0'
89
+ version: 1.3.0
66
90
  type: :development
67
91
  prerelease: false
68
- version_requirements: *70282867000520
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.3.0
69
97
  description: Provides a simple mapping between Active Record scopes and controller
70
98
  parameters for Ruby On Rails 3
71
99
  email: al@alweb.org
@@ -100,33 +128,26 @@ files:
100
128
  - spec/support/macros/user_macro.rb
101
129
  homepage: https://github.com/alexistoulotte/scoped_from
102
130
  licenses: []
131
+ metadata: {}
103
132
  post_install_message:
104
133
  rdoc_options: []
105
134
  require_paths:
106
135
  - lib
107
136
  required_ruby_version: !ruby/object:Gem::Requirement
108
- none: false
109
137
  requirements:
110
- - - ! '>='
138
+ - - '>='
111
139
  - !ruby/object:Gem::Version
112
140
  version: '0'
113
- segments:
114
- - 0
115
- hash: 1157272612327936896
116
141
  required_rubygems_version: !ruby/object:Gem::Requirement
117
- none: false
118
142
  requirements:
119
- - - ! '>='
143
+ - - '>='
120
144
  - !ruby/object:Gem::Version
121
145
  version: '0'
122
- segments:
123
- - 0
124
- hash: 1157272612327936896
125
146
  requirements: []
126
147
  rubyforge_project: scoped_from
127
- rubygems_version: 1.8.17
148
+ rubygems_version: 2.0.3
128
149
  signing_key:
129
- specification_version: 3
150
+ specification_version: 4
130
151
  summary: Mapping between scopes and parameters for Rails
131
152
  test_files:
132
153
  - spec/mocks/comment.rb