Skip to content

Commit

Permalink
Merge pull request #5 from michaeljbishop/update-for-new-rspec
Browse files Browse the repository at this point in the history
Updated the test case, ensured test passage.
  • Loading branch information
Ben Lavender committed Oct 12, 2012
2 parents ca575fa + b2e7482 commit ae70124
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
22 changes: 11 additions & 11 deletions Rakefile
@@ -1,30 +1,30 @@
require 'spec' require 'rspec'
require 'spec/rake/spectask' require 'rspec/core/rake_task'


desc 'Run specs' desc 'Run specs'
task 'spec' do task 'spec' do
Spec::Rake::SpecTask.new("spec") do |t| RSpec::Core::RakeTask.new("spec") do |t|
t.spec_files = FileList["spec/**/*.spec","spec/*.rb"] t.pattern = "spec/**/*.spec"
t.rcov = false t.rcov = false
t.spec_opts = ["-c"] t.rspec_opts = ["-c"]
end end
end end


desc 'Run specs with backtrace' desc 'Run specs with backtrace'
task 'tracespec' do task 'tracespec' do
Spec::Rake::SpecTask.new("tracespec") do |t| RSpec::Core::RakeTask.new("tracespec") do |t|
t.spec_files = FileList["spec/**/*.spec", "spec/*.rb"] t.pattern = "spec/**/*.spec"
t.rcov = false t.rcov = false
t.spec_opts = ["-bcfn"] t.rspec_opts = ["-bcfn"]
end end
end end


desc 'Run coverage' desc 'Run coverage'
task 'coverage' do task 'coverage' do
Spec::Rake::SpecTask.new("coverage") do |t| RSpec::Core::RakeTask.new("coverage") do |t|
t.spec_files = FileList["spec/**/*.spec","spec/*.rb"] t.pattern = "spec/**/*.spec"
t.rcov = true t.rcov = true
t.spec_opts = ["-c"] t.rspec_opts = ["-c"]
end end
end end


Expand Down
2 changes: 1 addition & 1 deletion lib/future.rb
Expand Up @@ -9,7 +9,7 @@
# y = x * 2 # => 6. blocks unless 5 seconds has passed. # y = x * 2 # => 6. blocks unless 5 seconds has passed.
# #
class Future < defined?(BasicObject) ? BasicObject : Object class Future < defined?(BasicObject) ? BasicObject : Object
instance_methods.each { |m| undef_method m unless m =~ /__/ } unless defined?(BasicObject) instance_methods.each { |m| undef_method m unless m =~ /^(__.*|object_id)$/ }


## ##
# Creates a new future. # Creates a new future.
Expand Down
4 changes: 2 additions & 2 deletions lib/promise.rb
Expand Up @@ -17,7 +17,7 @@
class Promise < defined?(BasicObject) ? BasicObject : ::Object class Promise < defined?(BasicObject) ? BasicObject : ::Object
NOT_SET = ::Object.new.freeze NOT_SET = ::Object.new.freeze


instance_methods.each { |m| undef_method m unless m.to_s =~ /__/ } instance_methods.each { |m| undef_method m unless m =~ /^(__.*|object_id)$/ }


## ##
# Creates a new promise. # Creates a new promise.
Expand All @@ -29,7 +29,7 @@ class Promise < defined?(BasicObject) ? BasicObject : ::Object
# @see Kernel#promise # @see Kernel#promise
def initialize(&block) def initialize(&block)
if block.arity > 0 if block.arity > 0
raise ArgumentError, "Cannot store a promise that requires an argument" ::Kernel.raise ::ArgumentError, "Cannot store a promise that requires an argument"
end end
@block = block @block = block
@mutex = ::Mutex.new @mutex = ::Mutex.new
Expand Down
4 changes: 2 additions & 2 deletions spec/future.spec
Expand Up @@ -26,8 +26,8 @@ describe Future do
y = x + 5 y = x + 5
y.should == 10 y.should == 10
finish = Time.now finish = Time.now
(middle - start).should be_close 0, 10**-2 (middle - start).should be_within(10**-2).of(0)
(finish - start).should be_close 3, 10**-2 (finish - start).should be_within(10**-2).of(3)
end end


end end
Expand Down
2 changes: 1 addition & 1 deletion spec/shared.rb
@@ -1,4 +1,4 @@
require 'spec' require 'rspec'
require 'promise' require 'promise'


shared_examples_for "A Promise" do shared_examples_for "A Promise" do
Expand Down

0 comments on commit ae70124

Please sign in to comment.