Permalink
Browse files

include tests

  • Loading branch information...
1 parent e476c77 commit a7cf187f6944114588923eed93e7eb49a7cbf907 @bry4n committed May 8, 2012
Showing with 52 additions and 3 deletions.
  1. +5 −0 Gemfile
  2. +9 −0 Rakefile
  3. +1 −1 examples/sleep.rb
  4. +3 −0 lib/parallel2/version.rb
  5. +3 −2 parallel2.gemspec
  6. +24 −0 spec/parallel_spec.rb
  7. +7 −0 spec/spec_helper.rb
View
@@ -1,3 +1,8 @@
source :rubygems
gemspec
+
+group :test do
+ gem 'rspec'
+ gem 'mocha'
+end
View
@@ -0,0 +1,9 @@
+require 'rspec/core/rake_task'
+require 'bundler/gem_tasks'
+
+task :default => :spec
+
+RSpec::Core::RakeTask.new do |t|
+ t.pattern = "spec/*_spec.rb"
+end
+
View
@@ -12,7 +12,7 @@
data = Parallel.map(list) do |i|
sleep i
puts "#{i} fired!"
- i
+ i*2
end
p data
View
@@ -0,0 +1,3 @@
+class Parallel
+ VERSION = "0.3.0"
+end
View
@@ -1,10 +1,11 @@
-$:.unshift File.expand_path('../lib', __FILE__)
+$:.unshift "lib"
require "rubygems"
+require 'parallel2/version'
Gem::Specification.new do |gem|
gem.name = "parallel2"
- gem.version = "0.2.0"
+ gem.version = Parallel::VERSION
gem.author = "Bryan Goines"
gem.summary = "Parallel#each and Parallel#map are using Celluloid::Future"
gem.email = "bryann83@gmail.com"
View
@@ -0,0 +1,24 @@
+require File.expand_path("../spec_helper", __FILE__)
+
+describe Parallel do
+
+ before do
+ @list = [1,2,3]
+ end
+
+ it "#map" do
+ data = Parallel.map(@list) do |i|
+ i * 2
+ end
+ data.should == [2,4,6]
+ end
+
+ it "#each" do
+ Parallel.stubs(:each).returns(@list)
+ data = Parallel.each(@list) do |i|
+ i
+ end
+ data.should == [1,2,3]
+ end
+
+end
View
@@ -0,0 +1,7 @@
+$:.unshift "lib"
+
+require 'parallel2'
+require 'rspec'
+require 'mocha'
+
+

0 comments on commit a7cf187

Please sign in to comment.