[macruby-changes] [1515] MacRuby/branches/experimental/spec/macruby
source_changes at macosforge.org
source_changes at macosforge.org
Sat May 2 09:47:44 PDT 2009
Revision: 1515
http://trac.macosforge.org/projects/ruby/changeset/1515
Author: eloy.de.enige at gmail.com
Date: 2009-05-02 09:47:43 -0700 (Sat, 02 May 2009)
Log Message:
-----------
Use the respond_to matcher to check for the existance of a method.
Modified Paths:
--------------
MacRuby/branches/experimental/spec/macruby/objc_method_spec.rb
MacRuby/branches/experimental/spec/macruby/spec_helper.rb
Modified: MacRuby/branches/experimental/spec/macruby/objc_method_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/macruby/objc_method_spec.rb 2009-05-02 15:34:51 UTC (rev 1514)
+++ MacRuby/branches/experimental/spec/macruby/objc_method_spec.rb 2009-05-02 16:47:43 UTC (rev 1515)
@@ -7,11 +7,8 @@
end
it "can be called with #foo= if it matches the #setFoo pattern" do
- # Note: we cannot use #have_method here because pure Objective-C
- # methods as well as convenience shortcuts are not exposed in #methods.
- @o.respond_to?(:'setFoo').should == true
- @o.respond_to?(:'foo=').should == true
- @o.respond_to?(:'foo').should == true
+ @o.should respond_to(:'setFoo')
+ @o.should respond_to(:'foo=')
@o.setFoo(123)
@o.foo.should == 123
@@ -20,22 +17,16 @@
end
it "can be called with #foo? if it matches the #isFoo pattern" do
- @o.respond_to?(:'isFoo').should == true
- @o.respond_to?(:'foo?').should == true
- @o.foo?.should == true
+ @o.should respond_to(:'isFoo')
+ @o.should respond_to(:'foo?')
- @o.respond_to?(:'isFoo2').should == true
- @o.respond_to?(:'foo2?').should == true
- @o.foo2?.should == false
+ @o.foo?.should equal(@o.isFoo)
end
it "is only exposed in #methods if the second argument is true" do
- o = Object.new
- o.methods.include?(:'performSelector').should == false
- o.methods(true).include?(:'performSelector').should == false
- o.methods(false).include?(:'performSelector').should == false
- o.methods(true, true).include?(:'performSelector').should == true
- o.methods(false, true).include?(:'performSelector').should == true
+ @o.methods.should_not include(:'performSelector')
+ @o.methods(true).should_not include(:'performSelector')
+ @o.methods(true, true).should include(:'performSelector')
end
it "can be called on an immediate object" do
Modified: MacRuby/branches/experimental/spec/macruby/spec_helper.rb
===================================================================
--- MacRuby/branches/experimental/spec/macruby/spec_helper.rb 2009-05-02 15:34:51 UTC (rev 1514)
+++ MacRuby/branches/experimental/spec/macruby/spec_helper.rb 2009-05-02 16:47:43 UTC (rev 1515)
@@ -1,12 +1,13 @@
framework 'Foundation'
+SPEC_ROOT = File.dirname(__FILE__)
+FIXTURES = File.join(SPEC_ROOT, "fixtures")
+
class FixtureCompiler
def self.require!(fixture)
new(fixture).require!
end
- FIXTURES = File.join(File.dirname(__FILE__), "fixtures")
-
FRAMEWORKS = %w{ Foundation }
ARCHS = %w{ i386 x86_64 ppc }
OPTIONS = %w{ -g -dynamiclib -fobjc-gc }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090502/b5007dd5/attachment.html>
More information about the macruby-changes
mailing list