Skip to content

Instantly share code, notes, and snippets.

@mostlyobvious
Last active December 25, 2015 11:59
Show Gist options
  • Save mostlyobvious/6973039 to your computer and use it in GitHub Desktop.
Save mostlyobvious/6973039 to your computer and use it in GitHub Desktop.
..FFF
Failures:
1) Dummy.foo stubbing class once in another example
Failure/Error: stub(Dummy).foo('same_argument')
ArgumentError:
tried to stub foo() with arguments: "same_argument"
# ./rbx_jruby_stubbing_class_method_spec.rb:32:in `(root)'
2) Dummy.new
Failure/Error: specify { Dummy.new(1, 2, 3) }
ArgumentError:
wrong number of arguments calling `new` (3 for 0)
# ./rbx_jruby_stubbing_class_method_spec.rb:39:in `(root)'
3) Dummy.new
Failure/Error: specify { Dummy.new(1, 2, 3) }
ArgumentError:
wrong number of arguments calling `new` (3 for 0)
# ./rbx_jruby_stubbing_class_method_spec.rb:40:in `(root)'
Finished in 0.1 seconds
5 examples, 3 failures
Failed examples:
rspec ./rbx_jruby_stubbing_class_method_spec.rb:31 # Dummy.foo stubbing class once in another example
rspec ./rbx_jruby_stubbing_class_method_spec.rb:39 # Dummy.new
rspec ./rbx_jruby_stubbing_class_method_spec.rb:40 # Dummy.new
.....
Finished in 0.01296 seconds
5 examples, 0 failures
.....
Finished in 0.02769 seconds
5 examples, 0 failures
..F.F
Failures:
1) Dummy.foo stubbing class once in another example
Failure/Error: stub(Dummy).foo('same_argument')
ArgumentError:
tried to stub foo() with arguments: "same_argument"
# kernel/bootstrap/proc.rb:22:in `call'
# ./rbx_jruby_stubbing_class_method_spec.rb:32:in `__script__'
# kernel/common/eval19.rb:45:in `instance_eval'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/proc.rb:22:in `call'
# kernel/loader.rb:728:in `run_at_exits'
# kernel/loader.rb:748:in `epilogue'
# kernel/loader.rb:882:in `main'
2) Dummy.new
Failure/Error: specify { Dummy.new(1, 2, 3) }
ArgumentError:
method 'new': given 3, expected 0
# ./rbx_jruby_stubbing_class_method_spec.rb:40:in `__script__'
# kernel/common/eval19.rb:45:in `instance_eval'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/array19.rb:18:in `map'
# kernel/bootstrap/proc.rb:22:in `call'
# kernel/loader.rb:728:in `run_at_exits'
# kernel/loader.rb:748:in `epilogue'
# kernel/loader.rb:882:in `main'
Finished in 0.04204 seconds
5 examples, 2 failures
Failed examples:
rspec ./rbx_jruby_stubbing_class_method_spec.rb:31 # Dummy.foo stubbing class once in another example
rspec ./rbx_jruby_stubbing_class_method_spec.rb:40 # Dummy.new
require 'bogus/rspec'
class Dummy
def self.bar(argument)
argument
end
def self.foo(argument)
argument
end
def initialize(*args)
args
end
end
describe Dummy do
context '.bar' do
specify 'stubbing class twice in example' do
stub(Dummy).bar('same_argument')
stub(Dummy).bar('same_argument')
end
end
context '.foo' do
specify 'stubbing class once in example' do
stub(Dummy).foo('same_argument')
end
specify 'stubbing class once in another example' do
stub(Dummy).foo('same_argument')
end
end
context '.new' do
before { stub(Dummy).new(any_args) }
specify { Dummy.new(1, 2, 3) }
specify { Dummy.new(1, 2, 3) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment