similar to: any reason we can''t use the concise stubs on Object

Displaying 20 results from an estimated 700 matches similar to: "any reason we can''t use the concise stubs on Object"

2007 Aug 08
1
Mocking Time, delegating to original object
In my Unit tests, I run into the all-too-common problem of Time.expects(:now) being called by Benchmark before the method is unmocked. Instead of messing around with the teardown order, I decided to modify the Expectation with a new method, .stops_mocking. Here are the changes I use, including a few monkey patches to push relevant objects down to where I want them, all wrapped up in a big ugly
2006 Dec 14
1
Patch: make rdoc of lib/mocha/object.rb instead of lib/stubba/object.rb
Index: Rakefile =================================================================== --- Rakefile (revision 73) +++ Rakefile (working copy) @@ -23,7 +23,7 @@ task.rdoc_dir = ''doc'' task.template = "html_with_google_analytics" task.options << "--line-numbers" << "--inline-source" -
2007 Apr 11
0
Fwd: [ mocha-Feature Requests-5856 ] Stubbing of private methods should be allowed
---------- Forwarded message ---------- From: noreply at rubyforge.org <noreply at rubyforge.org> Date: 11-Apr-2007 15:31 Subject: [ mocha-Feature Requests-5856 ] Stubbing of private methods should be allowed To: noreply at rubyforge.org Feature Requests item #5856, was opened at 2006-09-22 17:03 You can respond by visiting:
2009 Jun 13
2
removing Mocha; 'spec spec' fails but the specific model file passes
I happened to mix ryan bates'' authentication scaffold with rspec_scaffold on a demo project. and ran into the problem of mixing mock frameworks...ryan uses mocha. So, as a learning experience, I choose to redo ryan''s tests without mocha but ran into a strange problem with tests of the User model. With debugging you can see.... If you run just the user_spec.rb file, everything
2007 Nov 13
5
how to ensure signature compliance while mocking in ruby
On 13/11/2007, Pradeep Gatram <pradeep.gatram at gmail.com> wrote: > > Let me put my dilemma as an example. Take a look at a snippet from > FooTest. > > #using mocha > def test_method1 > Bar.expects(:method2).with(''param1'', ''param2'').once > Foo.method1 > end > > And now the implementation > > class Foo > def
2008 Mar 02
2
[LLVMdev] Struct layout assumptions
A question about the layout of structs: I decided to make my vtables out of structs rather than arrays. In other words, instead of being a table of opaque pointers, I decided to individually declare each entry with the correct type for that method. I figure that the various optimizers could do a better job if I preserve the type info. OK, so we come to the issue of inheritance: Suppose I have
2007 Jan 11
4
counter-intuitive behaveour when passing a proc to Mocha::Expectation#returns
Let''s say that I have a procedure that: * gets the number of bytes to write into some file * and returns the number of successfully written bytes def save( text, len ) This procedure is being used all over the place especially inside the method "process" which I want to test. Thus in order not to polute my filesystem I stub the "save" procedure. But of course in
2006 Jun 22
1
Change of controller name and SEO issue
Hi, I developed an app with cetain controller names. Now that the app is catching up I''m trying to change the controller names to be better aligned with the business. This is what I have now. http://localhost/foo/method1 http://localhost/foo/method2 http://localhost/foo/method2/a http://localhost/foo/method2/a/b http://localhost/foo/method2/a/b/c http://localhost/foo/method3 I would
2005 Sep 25
1
Prototype "classes" and inheritance
JavaScript doesn''t (yet) have a notion of classes. Prototype.js just adds a suitable convention for implementing them. It provides a way to create a new class by extending a base class using Object.extend, but it doesn''t handle method inheritance. There are ways of doing implementing this through traversing the chain of prototypes, but I''m not sure they are
2010 Aug 20
2
U value from wilcox.test
Dear all, I want to compare the efficiency of 2 methods in extracting proteins from algal samples. I collected 6 independant algal samples and I extracted 3 by the method 1 and 3 others by the method 2. So I have 2 groups of 3 samples, that are not paired. I would like to know if the results obtained by these 2 methods are significantly different, I hope method 2 to be more efficient than method
2012 Sep 04
0
get only little part of html with htmlParse
Here is my code. there are three method to get text to be parded by htmlParse function. 1.file on mycomputer options(encoding="gbk") library(XML) xmltext1 <- htmlParse("/home/tiger/Desktop/27174.htm" ) #/home/tiger/Desktop/27174.htm is the file of http://www.jb51.net/article/27174.htm downloaded on my computer. 2.url options(encoding="gbk")
2008 Nov 23
1
tklistbox - R-Objekt
Hello, I have a problem with a tklistbox. The user should be able to choose one out of two calculation methods needed for further calculations. My r-script for that purpose looks like that: require(tcltk) tt<-tktoplevel() tl<-tklistbox(tt,height=4,selectmode="single",background="white") tkgrid(tklabel(tt,text="select method for LAI
2006 Sep 25
3
Problem stubbing instances referred to by constants
Hi James, An instance retains its mocha between tests if that instance is pointed to by a constant. The simplest failing test is something like (add 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
2010 Jan 04
3
how to draw abline correctly?
Hello, I am frastruated with this graph, just cannot get what I need. Thank you for any suggestions or help. I really appreciate it. I wrote the following code, but there are 3 problems 1, the red line is added on the graph but without any marker on the y-axis. I want to display the number '.1361' on the y-axis. So people can easily tell 'method 2' gets a constant estimate, which
2011 Jun 01
1
Function to save plots
Hello, I'm using ROCR to plot ROC Curves and I want to automate the saving of plots into PNG files using a custom function. My data frames are named like test1, test2, test3. Each data frame has three variables: method1, method2, goldstandard. Right now, for each plot I have to run: png('test1_method1.png') plot(performance(prediction(test1$method1, test1$goldstandard),
2006 Jul 06
3
Calling Method
Is there a way to call a method if I only have a string that contains the method name. For example: @methods = [''method1'', ''method2'', ''method3''] @step = 1 # I want to call method2 which has a definition in this class -- Posted via http://www.ruby-forum.com/.
2007 Jan 17
8
Mocha Mock''s hanging on after test run?
Hi guys, I''m running mocha (0.3.2) against Rails core and just found an issue where the mock doesn''t go away after the test is run. For example: def test_reset_bang_doesn_reinstall_named_routes ActionController::Routing::Routes.named_routes.expects(:install).never @session.reset! end def test_zzz puts ActionController::Routing::Routes.named_routes.inspect
2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
On my current project I needed to create a stub that responded correctly to the id message. Here''s the change I put into my copy of head. Index: lib/mocha/mock_methods.rb =================================================================== --- lib/mocha/mock_methods.rb (revision 1114) +++ lib/mocha/mock_methods.rb (working copy) @@ -68,6 +68,7 @@ method_names =
2007 Mar 15
0
Covariance matrix calc method question
I have been comparing the output of an R package to S+Finmetrics and I notice that the covariance matrix outputted by the two procedures is different. The R package computes the covariance matrix using Method 1 and I think ( but I'm not sure ) that S+Finmetrics computes it using Method 2. I put in a correctionfactor (see below ) in to Method 2 in order to deal with the fact that the var
2011 Aug 16
2
how to get the result in "short cut" manner?
Hi all: My data:data(sleep) If I wanna calculate each group's extra,what I can do is: #method1 attach(sleep) mean(extra[group==1]) mean(extra[group==1]) #method2 result<-matrix(,0,2) g<-split(sleep,sleep$group) for(i in 1:length(g)) { result<-rbind(result,data.frame(unique(g[[i]]$group),mean(g[[i]]$extra))) } colnames(result)<-c("name","mean") But the above