test/system/much-stub_tests.rb in much-stub-0.1.6 vs test/system/much-stub_tests.rb in much-stub-0.1.7

- old
+ new

@@ -55,19 +55,19 @@ assert_equal "default", subject.withblock assert_equal "default", subject.withblock{ "my-block" } end should "not allow stubbing methods with invalid arity" do - assert_raises{ MuchStub.stub(subject, :noargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :noargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withargs).with{ } } - assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){ } } + assert_raises{ MuchStub.stub(subject, :withargs).with{} } + assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){} } - assert_raises{ MuchStub.stub(subject, :minargs).with{ } } - assert_raises{ MuchStub.stub(subject, :minargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :minargs).with{} } + assert_raises{ MuchStub.stub(subject, :minargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withblock).with(1){ } } + assert_raises{ MuchStub.stub(subject, :withblock).with(1){} } end should "not allow calling methods with invalid arity" do assert_raises{ subject.noargs(1) } @@ -128,19 +128,19 @@ assert_equal "default", subject.withblock assert_equal "default", subject.withblock{ "my-block" } end should "not allow stubbing methods with invalid arity" do - assert_raises{ MuchStub.stub(subject, :noargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :noargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withargs).with{ } } - assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){ } } + assert_raises{ MuchStub.stub(subject, :withargs).with{} } + assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){} } - assert_raises{ MuchStub.stub(subject, :minargs).with{ } } - assert_raises{ MuchStub.stub(subject, :minargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :minargs).with{} } + assert_raises{ MuchStub.stub(subject, :minargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withblock).with(1){ } } + assert_raises{ MuchStub.stub(subject, :withblock).with(1){} } end should "not allow calling methods with invalid arity" do assert_raises{ subject.noargs(1) } @@ -201,19 +201,19 @@ assert_equal "default", subject.withblock assert_equal "default", subject.withblock{ "my-block" } end should "not allow stubbing methods with invalid arity" do - assert_raises{ MuchStub.stub(subject, :noargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :noargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withargs).with{ } } - assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){ } } + assert_raises{ MuchStub.stub(subject, :withargs).with{} } + assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){} } - assert_raises{ MuchStub.stub(subject, :minargs).with{ } } - assert_raises{ MuchStub.stub(subject, :minargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :minargs).with{} } + assert_raises{ MuchStub.stub(subject, :minargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withblock).with(1){ } } + assert_raises{ MuchStub.stub(subject, :withblock).with(1){} } end should "not allow calling methods with invalid arity" do assert_raises{ subject.noargs(1) } @@ -274,19 +274,19 @@ assert_equal "default", subject.withblock assert_equal "default", subject.withblock{ "my-block" } end should "not allow stubbing methods with invalid arity" do - assert_raises{ MuchStub.stub(subject, :noargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :noargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withargs).with{ } } - assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){ } } + assert_raises{ MuchStub.stub(subject, :withargs).with{} } + assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){} } - assert_raises{ MuchStub.stub(subject, :minargs).with{ } } - assert_raises{ MuchStub.stub(subject, :minargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :minargs).with{} } + assert_raises{ MuchStub.stub(subject, :minargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withblock).with(1){ } } + assert_raises{ MuchStub.stub(subject, :withblock).with(1){} } end should "not allow calling methods with invalid arity" do assert_raises{ subject.noargs(1) } @@ -348,19 +348,19 @@ assert_equal "default", subject.withblock assert_equal "default", subject.withblock{ "my-block" } end should "not allow stubbing methods with invalid arity" do - assert_raises{ MuchStub.stub(subject, :noargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :noargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withargs).with{ } } - assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){ } } + assert_raises{ MuchStub.stub(subject, :withargs).with{} } + assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){} } - assert_raises{ MuchStub.stub(subject, :minargs).with{ } } - assert_raises{ MuchStub.stub(subject, :minargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :minargs).with{} } + assert_raises{ MuchStub.stub(subject, :minargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withblock).with(1){ } } + assert_raises{ MuchStub.stub(subject, :withblock).with(1){} } end should "not allow calling methods with invalid arity" do assert_raises{ subject.noargs(1) } @@ -421,19 +421,19 @@ assert_equal "default", subject.withblock assert_equal "default", subject.withblock{ "my-block" } end should "not allow stubbing methods with invalid arity" do - assert_raises{ MuchStub.stub(subject, :noargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :noargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withargs).with{ } } - assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){ } } + assert_raises{ MuchStub.stub(subject, :withargs).with{} } + assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){} } - assert_raises{ MuchStub.stub(subject, :minargs).with{ } } - assert_raises{ MuchStub.stub(subject, :minargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :minargs).with{} } + assert_raises{ MuchStub.stub(subject, :minargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withblock).with(1){ } } + assert_raises{ MuchStub.stub(subject, :withblock).with(1){} } end should "not allow calling methods with invalid arity" do assert_raises{ subject.noargs(1) } @@ -495,19 +495,19 @@ assert_equal "default", subject.withblock assert_equal "default", subject.withblock{ "my-block" } end should "not allow stubbing methods with invalid arity" do - assert_raises{ MuchStub.stub(subject, :noargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :noargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withargs).with{ } } - assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){ } } + assert_raises{ MuchStub.stub(subject, :withargs).with{} } + assert_raises{ MuchStub.stub(subject, :withargs).with(1, 2){} } - assert_raises{ MuchStub.stub(subject, :minargs).with{ } } - assert_raises{ MuchStub.stub(subject, :minargs).with(1){ } } + assert_raises{ MuchStub.stub(subject, :minargs).with{} } + assert_raises{ MuchStub.stub(subject, :minargs).with(1){} } - assert_raises{ MuchStub.stub(subject, :withblock).with(1){ } } + assert_raises{ MuchStub.stub(subject, :withblock).with(1){} } end should "not allow calling methods with invalid arity" do assert_raises{ subject.noargs(1) } @@ -568,19 +568,19 @@ assert_equal "default", subject.withblock assert_equal "default", subject.withblock{ "my-block" } end should "allow stubbing methods with invalid arity" do - assert_nothing_raised{ MuchStub.stub(subject, :noargs).with(1){ } } + assert_nothing_raised{ MuchStub.stub(subject, :noargs).with(1){} } - assert_nothing_raised{ MuchStub.stub(subject, :withargs).with{ } } - assert_nothing_raised{ MuchStub.stub(subject, :withargs).with(1, 2){ } } + assert_nothing_raised{ MuchStub.stub(subject, :withargs).with{} } + assert_nothing_raised{ MuchStub.stub(subject, :withargs).with(1, 2){} } - assert_nothing_raised{ MuchStub.stub(subject, :minargs).with{ } } - assert_nothing_raised{ MuchStub.stub(subject, :minargs).with(1){ } } + assert_nothing_raised{ MuchStub.stub(subject, :minargs).with{} } + assert_nothing_raised{ MuchStub.stub(subject, :minargs).with(1){} } - assert_nothing_raised{ MuchStub.stub(subject, :withblock).with(1){ } } + assert_nothing_raised{ MuchStub.stub(subject, :withblock).with(1){} } end should "allow calling methods with invalid arity" do assert_nothing_raised{ subject.noargs(1) } @@ -641,19 +641,19 @@ assert_equal "default", subject.withblock assert_equal "default", subject.withblock{ "my-block" } end should "allow stubbing methods with invalid arity" do - assert_nothing_raised{ MuchStub.stub(subject, :noargs).with(1){ } } + assert_nothing_raised{ MuchStub.stub(subject, :noargs).with(1){} } - assert_nothing_raised{ MuchStub.stub(subject, :withargs).with{ } } - assert_nothing_raised{ MuchStub.stub(subject, :withargs).with(1, 2){ } } + assert_nothing_raised{ MuchStub.stub(subject, :withargs).with{} } + assert_nothing_raised{ MuchStub.stub(subject, :withargs).with(1, 2){} } - assert_nothing_raised{ MuchStub.stub(subject, :minargs).with{ } } - assert_nothing_raised{ MuchStub.stub(subject, :minargs).with(1){ } } + assert_nothing_raised{ MuchStub.stub(subject, :minargs).with{} } + assert_nothing_raised{ MuchStub.stub(subject, :minargs).with(1){} } - assert_nothing_raised{ MuchStub.stub(subject, :withblock).with(1){ } } + assert_nothing_raised{ MuchStub.stub(subject, :withblock).with(1){} } end should "allow calling methods with invalid arity" do assert_nothing_raised{ subject.noargs(1) } @@ -682,41 +682,77 @@ assert_equal "child", @child_class.new end end class TestClass - def self.noargs; end - def self.withargs(a); end - def self.anyargs(*args); end - def self.minargs(a, b, *args); end - def self.withblock(&block); end + def self.noargs + end - def noargs; end - def withargs(a); end - def anyargs(*args); end - def minargs(a, b, *args); end - def withblock(&block); end + def self.withargs(a) + end + + def self.anyargs(*args) + end + + def self.minargs(a, b, *args) + end + + def self.withblock(&block) + end + + def noargs + end + + def withargs(a) + end + + def anyargs(*args) + end + + def minargs(a, b, *args) + end + + def withblock(&block) + end end module TestModule - def self.noargs; end - def self.withargs(a); end - def self.anyargs(*args); end - def self.minargs(a, b, *args); end - def self.withblock(&block); end + def self.noargs + end + + def self.withargs(a) + end + + def self.anyargs(*args) + end + + def self.minargs(a, b, *args) + end + + def self.withblock(&block) + end end module TestMixin - def noargs; end - def withargs(a); end - def anyargs(*args); end - def minargs(a, b, *args); end - def withblock(&block); end + def noargs + end + + def withargs(a) + end + + def anyargs(*args) + end + + def minargs(a, b, *args) + end + + def withblock(&block) + end end class DelegateClass - def self.respond_to?(*args) + def self.respond_to_missing?(*args) TestClass.respond_to?(*args) || super end def self.method_missing(name, *args, &block) TestClass.respond_to?(name) ? TestClass.send(name, *args, &block) : super @@ -724,10 +760,10 @@ def initialize @delegate = TestClass.new end - def respond_to?(*args) + def respond_to_missing?(*args) @delegate.respond_to?(*args) || super end def method_missing(name, *args, &block) @delegate.respond_to?(name) ? @delegate.send(name, *args, &block) : super