enumerable_mapper 0.5.5 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +0,0 @@
1
- desc 'Release the website and new gem version'
2
- task :deploy => [:check_version, :website, :release] do
3
- puts "Remember to create SVN tag:"
4
- puts "svn copy svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
- "svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
- puts "Suggested comment:"
7
- puts "Tagging release #{CHANGES}"
8
- end
9
-
10
- desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
- task :local_deploy => [:website_generate, :install_gem]
12
-
13
- task :check_version do
14
- unless ENV['VERSION']
15
- puts 'Must pass a VERSION=x.y.z release version'
16
- exit
17
- end
18
- unless ENV['VERSION'] == VERS
19
- puts "Please update your version.rb to match the release version, currently #{VERS}"
20
- exit
21
- end
22
- end
23
-
24
- desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
- task :install_gem_no_doc => [:clean, :package] do
26
- sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
- end
@@ -1,7 +0,0 @@
1
- task :ruby_env do
2
- RUBY_APP = if RUBY_PLATFORM =~ /java/
3
- "jruby"
4
- else
5
- "ruby"
6
- end unless defined? RUBY_APP
7
- end
data/tasks/website.rake DELETED
@@ -1,9 +0,0 @@
1
- # stubs for the website generation
2
- # To install the website framework:
3
- # script/generate website
4
-
5
- task :website_generate
6
-
7
- task :website_upload
8
-
9
- task :website => :publish_docs
@@ -1,36 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class String
4
- def pig_latin
5
- ( m = self.match( /^([bcdfghjklmnpqrstvwxyz])(.*)/i ) ) ? "#{m[2]}-#{m[1]}ay" : "#{self}-ay"
6
- end
7
- end
8
-
9
-
10
- class TestEnumerableMapper < Test::Unit::TestCase
11
-
12
- def setup
13
- end
14
-
15
- # Let's check that the pig latin translator works as intended
16
- def test_pig_latin
17
- assert_equal "utton-bay", "button".pig_latin
18
- assert_equal "eagle-ay", "eagle".pig_latin
19
- end
20
-
21
- def test_mapper
22
- assert Array.new.methods.include?( 'mapped' ), "All enumerables should have been extended with mapped"
23
- assert [1,2,3].mapped, "Array.mapped should return a value"
24
- assert [1,2,3].collected, "The collected alias should work as well"
25
- assert [1,2,3].mapped.kind_of?( Enumerable::Mapper ), "The returned object should be a mapper object"
26
- end
27
-
28
- def test_mapped
29
- assert_equal %w{enumerable-ay apper-may orks-way as-ay intended-ay}, %w{enumerable mapper works as intended}.mapped.pig_latin
30
- end
31
-
32
- def test_with_args
33
- assert_equal [0,1,0,1,0,1,0,1], [0,1,2,3,4,5,6,7].mapped.modulo( 2 )
34
- end
35
-
36
- end
@@ -1,42 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class Foo
4
- attr_accessor :name
5
- attr_accessor :type
6
- def initialize( name, type )
7
- @name, @type = name, type
8
- end
9
- end
10
-
11
-
12
- class TestGroupedBy < Test::Unit::TestCase
13
-
14
- def setup
15
- end
16
-
17
- def create_array
18
- [ Foo.new( 'inge', 'person' ), Foo.new( 'charlie', 'person' ), Foo.new( 'charlie', 'dog' ), Foo.new( 'oscar', 'dog' ) ]
19
- end
20
-
21
- def test_by_method_id
22
- test_array = create_array
23
- assert_equal 2, test_array.grouped_by( :type ).length
24
- assert_equal 3, test_array.grouped_by( :name ).length
25
- assert_equal 'person', test_array.grouped_by( :type )[0].first
26
- assert_equal 'dog', test_array.grouped_by( :type )[1].first
27
- assert_equal 2, test_array.grouped_by( :type )[0].last.length
28
- end
29
-
30
- def test_by_block
31
- test_array = create_array
32
- assert_equal 2, test_array.grouped_by{ |i| i.type }.length
33
- assert_equal 3, test_array.grouped_by{ |i| i.name }.length
34
- assert_equal 'PERSON', test_array.grouped_by{ |i| i.type.upcase }[0].first
35
- end
36
-
37
- def test_error
38
- test_array = create_array
39
- assert_raises( RuntimeError ) { test_array.grouped_by }
40
- end
41
-
42
- end