Permalink
Browse files

Merge branch 'master' of github.com:justinko/celluloid

  • Loading branch information...
2 parents b8997a1 + ba1af52 commit 5faa3e8cb304f4ccbc62e848e9b297e47d1e8c88 @tarcieri tarcieri committed Jun 21, 2011
View
@@ -1,14 +0,0 @@
-require 'autotest/rspec2'
-
-Autotest.add_hook :initialize do |autotest|
- autotest.add_exception '.git'
- autotest.clear_mappings
-
- # Map specs to themselves
- autotest.add_mapping(%r<^spec/.*_spec.rb$>) { |file, _| file }
-
- # Map libraries to specs
- autotest.add_mapping(%r<lib/celluloid/(.*).rb$>) do |_, m|
- ["spec/#{m[1]}_spec.rb"]
- end
-end
View
@@ -1,3 +1,3 @@
source :rubygems
-gemspec
+gemspec
View
@@ -2,16 +2,12 @@ require 'rubygems'
require 'bundler'
Bundler::GemHelper.install_tasks
-require 'rspec/core'
require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec) do |spec|
- spec.pattern = FileList['spec/**/*_spec.rb']
-end
+RSpec::Core::RakeTask.new
-RSpec::Core::RakeTask.new(:rcov) do |spec|
- spec.pattern = 'spec/**/*_spec.rb'
- spec.rcov = true
+RSpec::Core::RakeTask.new(:rcov) do |task|
+ task.rcov = true
end
-task :default => :spec
+task :default => :spec
@@ -63,25 +63,25 @@ def to_s
it "raises NoMethodError when a nonexistent method is called" do
actor = MyActor.spawn "Billy Bob Thornton"
- proc do
+ expect do
actor.the_method_that_wasnt_there
- end.should raise_exception(NoMethodError)
+ end.to raise_exception(NoMethodError)
end
it "reraises exceptions which occur during synchronous calls in the caller" do
actor = MyActor.spawn "James Dean" # is this in bad taste?
- proc do
+ expect do
actor.crash
- end.should raise_exception(MyActor::Crash)
+ end.to raise_exception(MyActor::Crash)
end
it "raises exceptions in the caller when abort is called, but keeps running" do
actor = MyActor.spawn "Al Pacino"
- proc do
+ expect do
actor.crash_with_abort MyActor::Crash.new("You die motherfucker!")
- end.should raise_exception(MyActor::Crash)
+ end.to raise_exception(MyActor::Crash)
actor.should be_alive
end
@@ -90,9 +90,9 @@ def to_s
actor = MyActor.spawn "James Dean"
actor.crash rescue nil
- proc do
+ expect do
actor.greet
- end.should raise_exception(Celluloid::DeadActorError)
+ end.to raise_exception(Celluloid::DeadActorError)
end
it "handles asynchronous calls" do
@@ -129,9 +129,9 @@ def to_s
actor = MyActor.spawn "Arnold Schwarzenegger"
actor.terminate
- proc do
+ expect do
actor.greet
- end.should raise_exception(Celluloid::DeadActorError)
+ end.to raise_exception(Celluloid::DeadActorError)
end
end
@@ -142,9 +142,9 @@ def to_s
end
it "raises NotActorError if called outside an actor" do
- proc do
+ expect do
Celluloid.current_actor
- end.should raise_exception(Celluloid::NotActorError)
+ end.to raise_exception(Celluloid::NotActorError)
end
end
@@ -188,9 +188,9 @@ def lambaste_subordinate(actor, reason)
chuck = Boss.spawn "Chuck Lorre"
chuck.link @charlie
- proc do
+ expect do
@charlie.crash
- end.should raise_exception(MyActor::Crash)
+ end.to raise_exception(MyActor::Crash)
sleep 0.1 # hax to prevent a race between exit handling and the next call
chuck.should be_subordinate_lambasted
@@ -15,6 +15,6 @@
class ExampleError < StandardError; end
future = Celluloid::Future() { raise ExampleError, "oh noes crash!" }
- proc { future.value }.should raise_exception(ExampleError)
+ expect { future.value }.to raise_exception(ExampleError)
end
end
@@ -17,19 +17,19 @@ class TestEvent < Celluloid::SystemEvent; end
it "raises system events when received" do
@mailbox.system_event TestEvent.new("example")
- proc do
+ expect do
@mailbox.receive
- end.should raise_exception(TestEvent)
+ end.to raise_exception(TestEvent)
end
it "prioritizes system events over other messages" do
@mailbox << :dummy1
@mailbox << :dummy2
@mailbox.system_event TestEvent.new("example")
- proc do
+ expect do
@mailbox.receive
- end.should raise_exception(TestEvent)
+ end.to raise_exception(TestEvent)
end
it "selectively receives messages with a block" do
@@ -15,8 +15,8 @@ def sing_for(person)
end
it "refuses to register non-Actors" do
- proc do
+ expect do
Celluloid::Actor[:impostor] = Object.new
- end.should raise_error(ArgumentError)
+ end.to raise_error(ArgumentError)
end
end
@@ -30,9 +30,9 @@ def crack_the_whip
subordinate.crack_the_whip
subordinate.state.should == :working
- proc do
+ expect do
subordinate.crack_the_whip
- end.should raise_exception(SubordinateDead)
+ end.to raise_exception(SubordinateDead)
sleep 0.1 # hax to prevent race :(
subordinate.should_not be_alive
@@ -49,9 +49,9 @@ def crack_the_whip
subordinate.crack_the_whip
subordinate.state.should == :working
- proc do
+ expect do
subordinate.crack_the_whip
- end.should raise_exception(SubordinateDead)
+ end.to raise_exception(SubordinateDead)
sleep 0.1 # hax to prevent race :(
subordinate.should_not be_alive
@@ -65,9 +65,9 @@ def crack_the_whip
subordinate = supervisor.actor
subordinate.state.should == :working
- proc do
+ expect do
subordinate.crack_the_whip
- end.should raise_exception(SubordinateDead)
+ end.to raise_exception(SubordinateDead)
sleep 0.1 # hax to prevent race :(
subordinate.should_not be_alive
@@ -81,9 +81,9 @@ def crack_the_whip
subordinate = Celluloid::Actor[:subordinate]
subordinate.state.should == :working
- proc do
+ expect do
subordinate.crack_the_whip
- end.should raise_exception(SubordinateDead)
+ end.to raise_exception(SubordinateDead)
sleep 0.1 # hax to prevent race :(
subordinate.should_not be_alive
View
@@ -1,12 +1,10 @@
-$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
-$LOAD_PATH.unshift File.dirname(__FILE__)
+require 'rubygems'
+require 'bundler'
+Bundler.setup
-require 'rspec'
require 'celluloid'
-# Squelch the logger (you may want it on for debugging)
-#Celluloid.logger = nil
+# Squelch the logger (comment out this line if you want it on for debugging)
+Celluloid.logger = nil
-# Requires supporting files with custom matchers and macros, etc,
-# in ./support/ and its subdirectories.
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
+Dir['./spec/support/*.rb'].map {|f| require f }

0 comments on commit 5faa3e8

Please sign in to comment.