scopes_for_associations 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ gemfile:
7
+ - gemfiles/active_record-3.0.Gemfile
8
+ - gemfiles/active_record-3.1.Gemfile
9
+ - gemfiles/active_record-3.2.Gemfile
@@ -1,4 +1,6 @@
1
- = Scopes for Associations
1
+ = Scopes for Associations [![Build Status](https://secure.travis-ci.org/ordinaryzelig/fandango.png?branch=master)](http://travis-ci.org/ordinaryzelig/fandango)
2
+
3
+ https://github.com/ordinaryzelig/scopes_for_associations
2
4
 
3
5
  == Description
4
6
 
@@ -66,5 +68,3 @@ The examples here are basically reproductions of the tests.
66
68
  == Compatibility
67
69
 
68
70
  works with ActiveRecord >=3.0.0
69
-
70
- gem-testers: http://gem-testers.org/gems/scopes_for_associations
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'activerecord', '3.0'
4
+
5
+ gemspec :path=>"../"
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'activerecord', '3.1'
4
+
5
+ gemspec :path=>"../"
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'activerecord', '3.2'
4
+
5
+ gemspec :path=>"../"
@@ -1,3 +1,5 @@
1
+ require 'active_record'
2
+
1
3
  module ScopesForAssociations
2
4
 
3
5
  def scopes_for_associations()
@@ -1,3 +1,3 @@
1
1
  module ScopesForAssociations
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -23,5 +23,5 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.add_development_dependency 'awesome_print'
25
25
  s.add_development_dependency 'rspec', '2.5.0'
26
- s.add_development_dependency 'sqlite3-ruby', '1.2.5'
26
+ s.add_development_dependency 'sqlite3', '1.3.5'
27
27
  end
@@ -5,9 +5,6 @@ describe ScopesForAssociations do
5
5
  let(:director) { Director.create! }
6
6
  let(:production_company) { ProductionCompany.create! }
7
7
  let(:movie) { Movie.create!(:director => director, :production_company => production_company) }
8
- let(:trailer) { Trailer.create!(:director => director, :production_company => production_company, :movie => movie) }
9
- let(:movie_comment) { Comment.create! :commentable_type => 'Movie', :commentable_id => movie.id }
10
- let(:trailer_comment) { Comment.create! :commentable_type => 'Trailer', :commentable_id => trailer.id }
11
8
 
12
9
  it 'should be included in ActiveRecord::Base' do
13
10
  ActiveRecord::Base.should respond_to(:scopes_for_associations)
@@ -49,6 +46,10 @@ describe ScopesForAssociations do
49
46
 
50
47
  context 'for polymorphic belongs_to associations' do
51
48
 
49
+ let(:trailer) { Trailer.create!(:movie => movie) }
50
+ let(:movie_comment) { Comment.create! :commentable_type => 'Movie', :commentable_id => movie.id }
51
+ let(:trailer_comment) { Comment.create! :commentable_type => 'Trailer', :commentable_id => trailer.id }
52
+
52
53
  it 'should define uesful scopes' do
53
54
  Comment.should define_scopes(
54
55
  :for_commentable_id,
@@ -1,5 +1,4 @@
1
1
  require 'pathname'
2
- require 'active_record'
3
2
  require 'awesome_print'
4
3
 
5
4
  require File.join(Pathname(__FILE__).dirname.expand_path, '../lib/scopes_for_associations')
@@ -1,7 +1,7 @@
1
1
  RSpec::Matchers.define :define_scopes do |*scopes|
2
2
  match do |model_class|
3
3
  scopes.each do |scope|
4
- model_class.scopes.keys.should include(scope)
4
+ model_class.respond_to? scope
5
5
  end
6
6
  end
7
7
  end
@@ -14,8 +14,6 @@ end
14
14
 
15
15
  class Trailer < ActiveRecord::Base
16
16
  belongs_to :movie
17
- belongs_to :director
18
- belongs_to :production_company
19
17
  has_many :comments, :as => :commentable
20
18
  scopes_for_associations
21
19
  end
@@ -10,8 +10,7 @@ ActiveRecord::Schema.define do
10
10
  create_table(:directors, :force => true)# { |t| }
11
11
  create_table(:production_companies, :force => true) { |t| }
12
12
  create_table :trailers, :force => true do |t|
13
- t.belongs_to :director
14
- t.belongs_to :production_company
13
+ t.belongs_to :movie
15
14
  end
16
15
  create_table :comments, :force => true do |t|
17
16
  t.belongs_to :commentable, :polymorphic => true
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scopes_for_associations
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jared Ning
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-13 00:00:00 -06:00
18
+ date: 2012-02-09 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -65,19 +65,19 @@ dependencies:
65
65
  type: :development
66
66
  version_requirements: *id003
67
67
  - !ruby/object:Gem::Dependency
68
- name: sqlite3-ruby
68
+ name: sqlite3
69
69
  prerelease: false
70
70
  requirement: &id004 !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
73
73
  - - "="
74
74
  - !ruby/object:Gem::Version
75
- hash: 21
75
+ hash: 17
76
76
  segments:
77
77
  - 1
78
- - 2
78
+ - 3
79
79
  - 5
80
- version: 1.2.5
80
+ version: 1.3.5
81
81
  type: :development
82
82
  version_requirements: *id004
83
83
  description: Define very basic, commonly used scopes for ActiveRecord associations. E.g. if a Post model has an author and a category association, scopes will be defined like Post.for(author) or Post.for(category).
@@ -90,13 +90,16 @@ extensions: []
90
90
  extra_rdoc_files: []
91
91
 
92
92
  files:
93
- - .gemtest
94
93
  - .gitignore
95
94
  - .rspec
96
95
  - .rvmrc
96
+ - .travis.yml
97
97
  - Gemfile
98
98
  - README.rdoc
99
99
  - Rakefile
100
+ - gemfiles/active_record-3.0.Gemfile
101
+ - gemfiles/active_record-3.1.Gemfile
102
+ - gemfiles/active_record-3.2.Gemfile
100
103
  - lib/scopes_for_associations.rb
101
104
  - lib/scopes_for_associations/version.rb
102
105
  - scopes_for_associations.gemspec
@@ -135,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
138
  requirements: []
136
139
 
137
140
  rubyforge_project: scopes-for-associations
138
- rubygems_version: 1.5.0
141
+ rubygems_version: 1.6.1
139
142
  signing_key:
140
143
  specification_version: 3
141
144
  summary: Define very basic, commonly used scopes for ActiveRecord associations
data/.gemtest DELETED
File without changes