Permalink
Browse files

first attempt at travis support

  • Loading branch information...
1 parent aa42384 commit 9ed41e24ac4b136935acaea9945b5fdab3b299cd @banister committed Feb 29, 2012
Showing with 116 additions and 92 deletions.
  1. +14 −0 .travis.yml
  2. +2 −0 Gemfile
  3. +9 −1 Rakefile
  4. +91 −91 test/{test.rb → test_binding_of_caller.rb}
View
@@ -0,0 +1,14 @@
+rvm:
+ - 1.9.2
+ - 1.9.3
+ - rbx-18mode
+ - rbx-19mode
+
+notifications:
+ irc: "irc.freenode.org#pry"
+ recipients:
+ - jrmair@gmail.com
+
+branches:
+ only:
+ - master
View
@@ -0,0 +1,2 @@
+source :rubygems
+gemspec
View
@@ -31,9 +31,17 @@ def apply_spec_defaults(s)
s.test_files = `git ls-files -- test/*`.split("\n")
end
+desc "Show version"
+task :version do
+ puts "BindingOfCaller version: #{BindingOfCaller::VERSION}"
+end
+
+desc "run tests"
+task :default => :test
+
desc "Run tests"
task :test do
- sh "bacon -Itest -rubygems test.rb -q"
+ sh "bacon -Itest -rubygems -a -q"
end
task :pry do
@@ -1,91 +1,91 @@
-unless Object.const_defined? :BindingOfCaller
- $:.unshift File.expand_path '../../lib', __FILE__
- require 'binding_of_caller'
- require 'binding_of_caller/version'
-end
-
-puts "Testing binding_of_caller version #{BindingOfCaller::VERSION}..."
-puts "Ruby version: #{RUBY_VERSION}"
-
-describe BindingOfCaller do
- describe "of_caller" do
- it "should fetch immediate caller's binding when 0 is passed" do
- o = Object.new
- def o.a
- var = 1
- binding.of_caller(0).eval('var')
- end
-
- o. a.should == 1
- end
-
- it "should fetch parent of caller's binding when 1 is passed" do
- o = Object.new
- def o.a
- var = 1
- b
- end
-
- def o.b
- binding.of_caller(1).eval('var')
- end
-
- o.a.should == 1
- end
-
- it "should modify locals in parent of caller's binding" do
- o = Object.new
- def o.a
- var = 1
- b
- var
- end
-
- def o.b
- binding.of_caller(1).eval('var = 20')
- end
-
- o.a.should == 20
- end
-
- it "should raise an exception when retrieving an out of band binding" do
- o = Object.new
- def o.a
- binding.of_caller(100)
- end
-
- lambda { o.a }.should.raise RuntimeError
- end
- end
-
- describe "frame_count" do
- it 'frame_count should equal callers.count' do
- binding.frame_count.should == binding.callers.count
- end
- end
-
- describe "frame_type" do
- it 'should return the correct frame types' do
- o = Object.new
-
- # method frame
- def o.a
- b
- end
-
- # method frame
- def o.b
- # block frame
- proc do
- binding.callers
- end.call
- end
- caller_bindings = o.a
- caller_bindings[0].frame_type.should == :block
- caller_bindings[1].frame_type.should == :method
- caller_bindings[2].frame_type.should == :method
- end
-
- end
-end
-
+unless Object.const_defined? :BindingOfCaller
+ $:.unshift File.expand_path '../../lib', __FILE__
+ require 'binding_of_caller'
+ require 'binding_of_caller/version'
+end
+
+puts "Testing binding_of_caller version #{BindingOfCaller::VERSION}..."
+puts "Ruby version: #{RUBY_VERSION}"
+
+describe BindingOfCaller do
+ describe "of_caller" do
+ it "should fetch immediate caller's binding when 0 is passed" do
+ o = Object.new
+ def o.a
+ var = 1
+ binding.of_caller(0).eval('var')
+ end
+
+ o. a.should == 1
+ end
+
+ it "should fetch parent of caller's binding when 1 is passed" do
+ o = Object.new
+ def o.a
+ var = 1
+ b
+ end
+
+ def o.b
+ binding.of_caller(1).eval('var')
+ end
+
+ o.a.should == 1
+ end
+
+ it "should modify locals in parent of caller's binding" do
+ o = Object.new
+ def o.a
+ var = 1
+ b
+ var
+ end
+
+ def o.b
+ binding.of_caller(1).eval('var = 20')
+ end
+
+ o.a.should == 20
+ end
+
+ it "should raise an exception when retrieving an out of band binding" do
+ o = Object.new
+ def o.a
+ binding.of_caller(100)
+ end
+
+ lambda { o.a }.should.raise RuntimeError
+ end
+ end
+
+ describe "frame_count" do
+ it 'frame_count should equal callers.count' do
+ binding.frame_count.should == binding.callers.count
+ end
+ end
+
+ describe "frame_type" do
+ it 'should return the correct frame types' do
+ o = Object.new
+
+ # method frame
+ def o.a
+ b
+ end
+
+ # method frame
+ def o.b
+ # block frame
+ proc do
+ binding.callers
+ end.call
+ end
+ caller_bindings = o.a
+ caller_bindings[0].frame_type.should == :block
+ caller_bindings[1].frame_type.should == :method
+ caller_bindings[2].frame_type.should == :method
+ end
+
+ end
+end
+

0 comments on commit 9ed41e2

Please sign in to comment.