Displaying 3 results from an estimated 3 matches for "test_b".
Did you mean:
test_
2007 Mar 30
7
problem with using any_instance
Hey all,
I have a question with using mocha in my tests.
In the same test file, I have two tests,
<code>
def test_a
klass.any_instance.stubs(:method_name).returns("something")
klass.new.method_name
...
end
def test_b
...
klass.new.method_name
...
end
</code>
where klass is some class
when the tests run, test _a passes, but test_b had an error like this:
test_b
NoMethodError: undefined method `method_name'' for #<klass:0xb6fb1934>
I put a
<code>
puts ''unstub called&...
2006 Sep 25
3
Problem stubbing instances referred to by constants
...as a new file in mocha/test)..
#--code--
require File.join(File.dirname(__FILE__), "test_helper")
require ''stubba''
class WemStubbaTest < Test::Unit::TestCase
Arr = [1, 2, 3]
def test_a
Arr.stubs(:size).returns(6)
assert_equal 6, Arr.size
end
def test_b
assert_equal 3, Arr.size #=> Failing test when both tests run consecutively
end
end
#--/code--
I got as far as noticing that Stubba::InstanceMethod#unstub is
''intentionally empty''. This is fine for most object instances but not
ones that hang around (like the array ab...
2012 Mar 19
0
Reshape data frame with dcast and melt
...e <- dcast(data, formula_wide)
# Resort data
formula_sort <- as.formula(paste("~", paste(ids, collapse="+")))
data_wide <- sort(data_wide, f = formula_sort)
return(data_wide)
}
d <- data.frame(
test_name = c(rep("Test_A", 6), rep("Test_B", 6)),
group_name = c(rep("Group_C", 3), rep("Group_D", 3), rep("Group_C", 3),
rep("Group_D", 3)),
id = c("I1", "I2", "I3", "I4", "I5", "I6",
"I1", "I2",...