forked from metaskills/grouped_scope
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New gem layout using a Gemfile for development. - Switch to MiniTest::Spec.
- Loading branch information
1 parent
4a21726
commit f9827e7
Showing
18 changed files
with
249 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
.DS_Store | ||
test/debug.log | ||
debug.log | ||
autotest | ||
.rbenv-version | ||
.rbenv-version | ||
Gemfile.lock | ||
debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
source :rubygems | ||
source 'http://gems.github.com/' | ||
|
||
spec = eval(File.read('grouped_scope.gemspec')) | ||
ar_version = spec.dependencies.detect{ |d|d.name == 'activerecord' }.requirement.to_s | ||
|
||
gem 'sqlite3', '1.3.4' | ||
gem 'activerecord', ar_version, :require => 'active_record' | ||
gem 'mislav-will_paginate', '2.3.4', :require => 'will_paginate' | ||
|
||
group :development do | ||
gem 'rake', '0.8.7' | ||
end | ||
|
||
group :test do | ||
gem 'minitest', '2.5.1' | ||
gem 'mini_shoulda', '0.4.0' | ||
gem 'factory_girl', '2.1.0' | ||
gem 'mocha', '0.10.0' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,14 @@ | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
|
||
def reset_invoked | ||
['test_rails','test'].each do |name| | ||
Rake::Task[name].instance_variable_set '@already_invoked', false | ||
end | ||
end | ||
|
||
|
||
desc 'Default: run unit tests.' | ||
task :default => :test_rails | ||
task :default => :test | ||
|
||
desc 'Test the GroupedScope plugin.' | ||
Rake::TestTask.new(:test) do |t| | ||
Rake::TestTask.new do |t| | ||
t.libs << 'lib' | ||
t.libs << 'test' | ||
t.pattern = 'test/**/*_test.rb' | ||
t.verbose = true | ||
end | ||
|
||
desc 'Test the GroupedScope plugin with Rails 2.3.2, 2.2.2, and 2.1.1 gems' | ||
task :test_rails do | ||
test = Rake::Task['test'] | ||
versions = ['2.3.2','2.2.2','2.1.1'] | ||
versions.each do |version| | ||
ENV['RAILS_VERSION'] = "#{version}" | ||
test.invoke | ||
reset_invoked unless version == versions.last | ||
end | ||
end | ||
|
||
desc 'Generate documentation for the GroupedScope plugin.' | ||
Rake::RDocTask.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'GroupedScope' | ||
rdoc.options << '--line-numbers' << '--inline-source' | ||
rdoc.rdoc_files.include('README') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,20 @@ | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "grouped_scope/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "grouped_scope" | ||
s.version = "0.6.0" | ||
s.date = "2009-05-06" | ||
s.summary = "Extends has_many associations to group scope." | ||
s.email = "[email protected]" | ||
s.homepage = "http://github.com/metaskills/grouped_scope/" | ||
s.description = "Extends has_many associations to group scope." | ||
s.has_rdoc = true | ||
s.authors = ["Ken Collins"] | ||
s.files = [ | ||
"CHANGELOG", | ||
"MIT-LICENSE", | ||
"Rakefile", | ||
"README.rdoc", | ||
"init.rb", | ||
"lib/grouped_scope.rb", | ||
"lib/grouped_scope/association_reflection.rb", | ||
"lib/grouped_scope/class_methods.rb", | ||
"lib/grouped_scope/core_ext.rb", | ||
"lib/grouped_scope/errors.rb", | ||
"lib/grouped_scope/grouping.rb", | ||
"lib/grouped_scope/has_many_association.rb", | ||
"lib/grouped_scope/has_many_through_association.rb", | ||
"lib/grouped_scope/instance_methods.rb", | ||
"lib/grouped_scope/self_grouping.rb" ] | ||
s.test_files = [ | ||
"test/factories.rb", | ||
"test/grouped_scope/association_reflection_test.rb", | ||
"test/grouped_scope/class_methods_test.rb", | ||
"test/grouped_scope/has_many_association_test.rb", | ||
"test/grouped_scope/has_many_through_association_test.rb", | ||
"test/grouped_scope/self_grouping_test.rb", | ||
"test/helper.rb", | ||
"test/lib/boot.rb", | ||
"test/lib/test_case.rb" ] | ||
s.rdoc_options = ["--main", "README.rdoc"] | ||
s.extra_rdoc_files = ["README.rdoc","CHANGELOG","MIT-LICENSE"] | ||
s.name = 'grouped_scope' | ||
s.version = GroupedScope::VERSION | ||
s.platform = Gem::Platform::RUBY | ||
s.authors = ['Ken Collins'] | ||
s.email = ['[email protected]'] | ||
s.homepage = 'http://github.com/metaskills/grouped_scope/' | ||
s.summary = 'Extends has_many associations to group scope.' | ||
s.description = 'Extends has_many associations to group scope. For ActiveRecord 2.3.x!' | ||
s.files = `git ls-files`.split("\n") - ["grouped_scope.gemspec"] | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ['lib'] | ||
s.rdoc_options = ['--charset=UTF-8'] | ||
s.add_dependency 'activerecord', '~> 2.3.14' | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module GroupedScope | ||
|
||
VERSION = '0.6.1' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,41 @@ | ||
FactoryGirl.define do | ||
|
||
sequence(:id) { |n| n } | ||
sequence(:email) { |n| "test_#{n}@domain.com" } | ||
sequence(:title) { |n| "Report Title ##{n}" } | ||
|
||
factory :report do | ||
title { FactoryGirl.generate(:title) } | ||
body 'Bla bla bla. Bla. Bla bla.' | ||
end | ||
|
||
factory :employee do | ||
name { "Factory Employee ##{FactoryGirl.generate(:id)}" } | ||
email { FactoryGirl.generate(:email) } | ||
end | ||
|
||
factory :employee_with_reports, :parent => :employee do | ||
reports { |e| [e.association(:report), e.association(:report)] } | ||
end | ||
|
||
factory :employee_with_urgent_reports, :parent => :employee do | ||
reports { |e| [e.association(:report), e.association(:report, :title=>'URGENT'), | ||
e.association(:report), e.association(:report, :body=>'This is URGENT.')] } | ||
end | ||
|
||
factory :legacy_employee do | ||
name { "Legacy Factory Employee ##{FactoryGirl.generate(:id)}" } | ||
email { FactoryGirl.generate(:email) } | ||
end | ||
|
||
factory :legacy_report do |r| | ||
r.title { FactoryGirl.generate(:title) } | ||
r.body 'Legacy bla bla. Legacy. Legacy bla.' | ||
end | ||
|
||
factory :legacy_employee_with_reports, :parent => :legacy_employee do | ||
reports { |e| [e.association(:legacy_report), e.association(:legacy_report)] } | ||
end | ||
|
||
Factory.sequence(:id) { |n| n } | ||
Factory.sequence(:email) { |n| "test_#{n}@domain.com" } | ||
Factory.sequence(:title) { |n| "Report Title ##{n}" } | ||
|
||
Factory.define :employee do |e| | ||
e.name { "Factory Employee ##{Factory.next(:id)}" } | ||
e.email { Factory.next(:email) } | ||
end | ||
|
||
Factory.define :report do |r| | ||
r.title { Factory.next(:title) } | ||
r.body 'Bla bla bla. Bla. Bla bla.' | ||
end | ||
|
||
Factory.define :employee_with_reports, :class => 'Employee' do |e| | ||
e.name { "Factory Employee ##{Factory.next(:id)}" } | ||
e.email { Factory.next(:email) } | ||
e.reports { |employee| [employee.association(:report),employee.association(:report)] } | ||
end | ||
|
||
Factory.define :employee_with_urgent_reports, :class => 'Employee' do |e| | ||
e.name { "Factory Employee ##{Factory.next(:id)}" } | ||
e.email { Factory.next(:email) } | ||
e.reports { |employee| [employee.association(:report), employee.association(:report,:title=>'URGENT'), | ||
employee.association(:report), employee.association(:report,:body=>'This is URGENT.')] } | ||
end | ||
|
||
|
||
Factory.define :legacy_employee do |e| | ||
e.name { "Legacy Factory Employee ##{Factory.next(:id)}" } | ||
e.email { Factory.next(:email) } | ||
end | ||
|
||
Factory.define :legacy_report do |r| | ||
r.title { Factory.next(:title) } | ||
r.body 'Legacy bla bla. Legacy. Legacy bla.' | ||
end | ||
|
||
Factory.define :legacy_employee_with_reports, :class => 'LegacyEmployee' do |e| | ||
e.name { "Legacy Factory Employee ##{Factory.next(:id)}" } | ||
e.email { Factory.next(:email) } | ||
e.reports { |employee| [employee.association(:legacy_report),employee.association(:legacy_report)] } | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.