squeel 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ gemspec
3
3
 
4
4
  gem 'rake'
5
5
 
6
- rails = ENV['RAILS'] || 'master'
6
+ rails = ENV['RAILS'] || '3-2-stable'
7
7
  arel = ENV['AREL'] || 'master'
8
8
 
9
9
  arel_opts = case arel
@@ -12,8 +12,9 @@ module Squeel
12
12
 
13
13
  # We need some methods to fall through to the endpoint or create a new
14
14
  # stub of the given name
15
- %w(id == != =~ !~ desc).each do |method_name|
16
- undef_method method_name if method_defined?(method_name) || private_method_defined?(method_name)
15
+ %w(id type == != =~ !~ desc).each do |method_name|
16
+ undef_method method_name if method_defined?(method_name) ||
17
+ private_method_defined?(method_name)
17
18
  end
18
19
 
19
20
  # @return [Array<Symbol, Stub, Join>] The path
@@ -24,7 +24,12 @@ module Squeel
24
24
  alias :< :lt
25
25
  alias :<= :lteq
26
26
 
27
- undef_method :id if method_defined?(:id)
27
+ # We dn't want these default Object methods, because if we're
28
+ # calling them we are probably talking about a column name
29
+ [:id, :type].each do |column_method|
30
+ undef_method column_method if method_defined?(column_method) ||
31
+ private_method_defined?(column_method)
32
+ end
28
33
 
29
34
  # @return [Symbol] The symbol contained by this stub
30
35
  attr_reader :symbol
@@ -129,4 +134,4 @@ module Squeel
129
134
 
130
135
  end
131
136
  end
132
- end
137
+ end
@@ -1,3 +1,3 @@
1
1
  module Squeel
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -26,6 +26,11 @@ module Squeel
26
26
  expect { @k.another }.to raise_error NoMethodError
27
27
  end
28
28
 
29
+ it 'allows specification of a type column' do
30
+ node = @k.type
31
+ node.should be_a KeyPath # not a Class (Ruby 1.8 Object#type)
32
+ end
33
+
29
34
  it 'sends missing calls to its endpoint if the endpoint responds to them' do
30
35
  @k.third.fourth.fifth.matches('Joe%')
31
36
  @k.endpoint.should be_a Predicate
@@ -105,4 +110,4 @@ module Squeel
105
110
 
106
111
  end
107
112
  end
108
- end
113
+ end
@@ -33,6 +33,18 @@ module Squeel
33
33
  keypath.path_with_endpoint.should eq [@s, Stub.new(:another)]
34
34
  end
35
35
 
36
+ it 'creates a KeyPath when sent #id' do
37
+ keypath = @s.id
38
+ keypath.should be_a KeyPath
39
+ keypath.path_with_endpoint.should eq [@s, Stub.new(:id)]
40
+ end
41
+
42
+ it 'creates a KeyPath when sent #type' do
43
+ keypath = @s.type
44
+ keypath.should be_a KeyPath
45
+ keypath.path_with_endpoint.should eq [@s, Stub.new(:type)]
46
+ end
47
+
36
48
  it 'creates a KeyPath with a join endpoint when sent a method with a Class param' do
37
49
  keypath = @s.another(Person)
38
50
  keypath.should be_a KeyPath
@@ -202,4 +214,4 @@ module Squeel
202
214
 
203
215
  end
204
216
  end
205
- end
217
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squeel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-22 00:00:00.000000000 -04:00
12
+ date: 2012-05-02 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
17
- requirement: &70321134916300 !ruby/object:Gem::Requirement
17
+ requirement: &70156349477400 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70321134916300
25
+ version_requirements: *70156349477400
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activesupport
28
- requirement: &70321134915080 !ruby/object:Gem::Requirement
28
+ requirement: &70156349476680 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70321134915080
36
+ version_requirements: *70156349476680
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: polyamorous
39
- requirement: &70321134914020 !ruby/object:Gem::Requirement
39
+ requirement: &70156349475880 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 0.5.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70321134914020
47
+ version_requirements: *70156349475880
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rspec
50
- requirement: &70321134911960 !ruby/object:Gem::Requirement
50
+ requirement: &70156349475260 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 2.6.0
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70321134911960
58
+ version_requirements: *70156349475260
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: machinist
61
- requirement: &70321134928680 !ruby/object:Gem::Requirement
61
+ requirement: &70156349474620 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 1.0.6
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70321134928680
69
+ version_requirements: *70156349474620
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: faker
72
- requirement: &70321134927360 !ruby/object:Gem::Requirement
72
+ requirement: &70156349473320 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 0.9.5
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70321134927360
80
+ version_requirements: *70156349473320
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: sqlite3
83
- requirement: &70321134925640 !ruby/object:Gem::Requirement
83
+ requirement: &70156349488720 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,7 +88,7 @@ dependencies:
88
88
  version: 1.3.3
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *70321134925640
91
+ version_requirements: *70156349488720
92
92
  description: ! "\n Squeel unlocks the power of ARel in your Rails 3 application
93
93
  with\n a handy block-based syntax. You can write subqueries, access named\n
94
94
  \ functions provided by your RDBMS, and more, all without writing\n SQL
@@ -201,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  segments:
203
203
  - 0
204
- hash: -1688941417700106629
204
+ hash: 3396698856870050214
205
205
  required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  none: false
207
207
  requirements:
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  version: '0'
211
211
  segments:
212
212
  - 0
213
- hash: -1688941417700106629
213
+ hash: 3396698856870050214
214
214
  requirements: []
215
215
  rubyforge_project: squeel
216
216
  rubygems_version: 1.3.9.4