[rspec-users] What is the pattern for testing a time argument using argument matcher

2012-01-26 Thread Yi Wen
Say I do: ```ruby object.method 5.days.ago ``` In the test I want to test using should_receive like: ```ruby object.should_receive(:method).with(5.days.ago) ``` This will fail since two time objects aren't exact the same. What is the general pattern for testing this in rspec? Thanks _

[rspec-users] html formatter

2010-08-16 Thread Yi Wen
For rspec 2.0, is there anyway we can specify which file the output should be written into when using html formatter easily? Thanks Yi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] predicate matching

2009-09-18 Thread Yi Wen
Chelimsky wrote: On Fri, Sep 18, 2009 at 10:42 AM, Yi Wen wrote: Hi all, I noticed that if I have a method named has_somthing? and I do: object.should_not have_somthing and it failed (as expected) when the method returns nil. Actually, this should pass. The have_xxx and be_xxx matchers

Re: [rspec-users] predicate matching

2009-09-18 Thread Yi Wen
Sorry for the spam, but I was wrong: the *should_not have_something* also passed when the method returned nil. On Sep 18, 2009, at 10:42 AM, Yi Wen wrote: Hi all, I noticed that if I have a method named has_somthing? and I do: object.should_not have_somthing and it failed (as expected) when

[rspec-users] predicate matching

2009-09-18 Thread Yi Wen
Hi all, I noticed that if I have a method named has_somthing? and I do: object.should_not have_somthing and it failed (as expected) when the method returns nil. But if the method is something? and I do: object.should_not be_something, and it succeeded (not what I expected) when something? r

[rspec-users] [cucumber] table.hashes

2009-07-28 Thread Yi Wen
Hi, I had a couple features failed with cucumber 0.3.90 because table.hashes is frozen so I cannot change the hashes anymore. Just wonder what's the reason behind the change? Thanks Yi ___ rspec-users mailing list rspec-users@rubyforge.org htt

Re: [rspec-users] Validations are making me want to scream. help please

2009-07-11 Thread Yi Wen
There is a validation error, which means you were trying to save the object somewhere. Check both your tests and code, to find out where. On Jul 11, 2009, at 10:42 AM, Michael wrote: Simply testing that my validations are working for a model called Project. MODEL class Project < ActiveRecord

Re: [rspec-users] Noob syntax questions regarding rspec book...

2009-07-07 Thread Yi Wen
They are regex. On Jul 7, 2009, at 10:35 AM, Chris Sund wrote: Hey Everyone, I've been working my way through the Rspec book trying to absorb and understand everything. This is my first time with BDD and I'm just trying to figure out some simple syntax stuff. My questions revolve around some of

Re: [rspec-users] Spork 0.57

2009-06-19 Thread Yi Wen
Yup, removing the condition fixed the problem. Thanks! On Jun 19, 2009, at 9:34 AM, David Chelimsky wrote: On Fri, Jun 19, 2009 at 9:33 AM, David Chelimsky wrote: On Fri, Jun 19, 2009 at 9:24 AM, Yi Wen wrote: Hello, I has spork 0.5.0 and worked fine. now I updated to spork 0.5.7 which

[rspec-users] Spork 0.57

2009-06-19 Thread Yi Wen
Hello, I has spork 0.5.0 and worked fine. now I updated to spork 0.5.7 which seems to break the existing setting. The stack trace looks like this: Using RSpec Preloading Rails environment Loading Spork.prefork block... uninitialized constant MissingSourceFile (NameError) /my_proj/vendor/gems/

Re: [rspec-users] wrong number of arguments (2 for 1)

2009-02-25 Thread Yi Wen
Unfortunately, it doesn't solve the problem. Thanks anyway Yi On Wed, Feb 25, 2009 at 5:18 PM, Mark Wilden wrote: > On Wed, Feb 25, 2009 at 2:50 PM, Yi Wen wrote: > > The following statement gave me "wrong number of arguments (2 for 1)" and > it > >

Re: [rspec-users] wrong number of arguments (2 for 1)

2009-02-25 Thread Yi Wen
now is the perfect time to do so. Thanks! Yi On Wed, Feb 25, 2009 at 5:04 PM, David Chelimsky wrote: > On Wed, Feb 25, 2009 at 4:50 PM, Yi Wen wrote: > > The following statement gave me "wrong number of arguments (2 for 1)" and > it > > is the only error. no stack t

[rspec-users] wrong number of arguments (2 for 1)

2009-02-25 Thread Yi Wen
The following statement gave me "wrong number of arguments (2 for 1)" and it is the only error. no stack trace. presenter.stub!(:account).and_return account any idea? Thanks Yi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyfo

Re: [rspec-users] RSpec with edge rails (2.3 RC1)

2009-02-25 Thread Yi Wen
I have edge rails along with RSpec 1.1.99. works fine. What errors do you get? On Wed, Feb 25, 2009 at 1:24 PM, George Anderson wrote: > Hi, > > I'm failing miserably to get RSpec running with edge rails (2.3 RC1). > I've tried building/installing the 1.1.99.1 gems from David's git > repos (http:

Re: [rspec-users] [cucumber] Cucumber and CI

2009-02-22 Thread Yi Wen
yeah, you guys are probably right on this. I was just over stating. :) Yi On Sun, Feb 22, 2009 at 8:36 PM, Phlip wrote: > Yi Wen wrote: > > I totally agree with you on this. I have a feeling a lot of people kind of >> use cucumber as a sexy way for doing waterfall. >>

Re: [rspec-users] [cucumber] Cucumber and CI

2009-02-22 Thread Yi Wen
tests passing as checkin points. Thanks Yi On Sun, Feb 22, 2009 at 3:36 PM, aslak hellesoy wrote: > On Sun, Feb 22, 2009 at 8:47 PM, Yi Wen wrote: > > The rhythm for wrking with cucumber advertised by http://cukes.info/ is > to > > write tests that fails first, then code that fi

Re: [rspec-users] [cucumber] Cucumber and CI

2009-02-22 Thread Yi Wen
I totally agree with you on this. I have a feeling a lot of people kind of use cucumber as a sexy way for doing waterfall. On Sun, Feb 22, 2009 at 5:18 PM, Mark Wilden wrote: > On Sun, Feb 22, 2009 at 1:36 PM, aslak hellesoy > wrote: > > You don't have to write all > > scenarios when you start

[rspec-users] [cucumber] Cucumber and CI

2009-02-22 Thread Yi Wen
The rhythm for wrking with cucumber advertised by http://cukes.info/ is to write tests that fails first, then code that fixes it. Now my question is, what is the implication when combine this with Continuous Integration? We all know when we do TDD/BDD in unit level, one test can be fixed fairly qu

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Yi Wen
idates_presence_of).with(:email) I am not really advocating the view of mockists. Just throw a question here. :) Yi On Wed, Feb 18, 2009 at 11:40 PM, Stephen Eley wrote: > On Wed, Feb 18, 2009 at 11:42 PM, Yi Wen wrote: > > > > Without this syntax sugar, we still have to test val

Re: [rspec-users] validate_presence_of

2009-02-18 Thread Yi Wen
We should write a test/spec, whatever you call it, *first* before you want your code. But it doesn't mean one who writes the spec/test will use a monkey coding the code to fix the test. To be realistic, a programmer will write this test, and implement it right away. Just like how TDD should be done

Re: [rspec-users] validate_presence_of

2009-02-17 Thread Yi Wen
ah! sorry, my bad. Thanks! On Tue, Feb 17, 2009 at 6:56 PM, David Chelimsky wrote: > On Tue, Feb 17, 2009 at 6:25 PM, Yi Wen wrote: > > Sorry for the spam, I relized there was a typo. It should be > >it {should validate_presence_of(:login)} > > It still didn'

Re: [rspec-users] validate_presence_of

2009-02-17 Thread Yi Wen
Sorry for the spam, I relized there was a typo. It should be it {should validate_presence_of(:login)} It still didn't work On Tue, Feb 17, 2009 at 6:04 PM, Yi Wen wrote: > Hello, > > according to this post: > http://blog.davidchelimsky.net/2009/1/13/rspec-1-1-12-is-rele

[rspec-users] validate_presence_of

2009-02-17 Thread Yi Wen
Hello, according to this post: http://blog.davidchelimsky.net/2009/1/13/rspec-1-1-12-is-released I should be able to write: describe User do it {should valdate_presence_of(:login)} end with rspec 1.1.12 But I got: NO NAME undefined method `valdate_presence_of' for # What did I do it wrong?

[rspec-users] Is RSpec Ruby1.9 ready?

2009-02-06 Thread Yi Wen
Hi, I saw a message on Nov, 2008 in this mailing list from David: "I'm not sure how to fix that problem, but before you go much further you should know that RSpec does not yet run under 1.9. It's something I want to raise in priority soon, and patches are welcome, but that's the state of things t

Re: [rspec-users] OK... What is ... fu ?

2009-01-30 Thread Yi Wen
This "Fu" you refer to is actually different than "Fu" as in "Kung-Fu". The fu as in kung-fu by itself, means husband. In Ancient Chinese, it also means wise person, such as confucius(Kong Fu Zi). On Fri, Jan 30, 2009 at 9:06 AM, David Chelimsky wrote: > On Fri, Jan 30, 2009 at 8:49 AM, James Byr

Re: [rspec-users] Nosy controller specs

2008-12-11 Thread Yi Wen
yeah, instead of using Post.find(:all) in your controller, use a method like Post.all_posts, or some names like that. Then in the controller spec, you go: Post.should_receive(:all_posts) and leave the implementation detail of this method to the Post model. Technically speaking, this all_posts more

Re: [rspec-users] `add_scenario': wrong, number of arguments (1 for 2)

2008-11-18 Thread Yi Wen
Weird, it seems like a bug to me: def Scenario(name, &proc) add_scenario(name, &proc) end def add_scenario(name, line, &proc) scenario = Scenario.new(self, name, line, &proc) @scenarios << scenario scenario end Scenario lacks a "line" argum

[rspec-users] How to use config.gem for rspec and rspec-rails

2008-11-17 Thread Yi Wen
Hi, Is there anyway I can specify config.gem rspec :lib => "spec" config.gem rspec-rails :lib => "spec/rails" in my test.rb? Basically I got this after I specify rspec rake gems:unpack RAILS_ENV=test (in /home/ywen/projects/kod) rake aborted! uninitialized constant Spec::Rake /home/ywen/project

Re: [rspec-users] Should acceptance tests be run against a production environment?

2008-10-29 Thread Yi Wen
I agree. I have seen way too many times selenium tests are OK but bugs appear in production. Not only should we run selenium tests against production environment, but also they should be run on a production like environment, such as, same OS, same setting (behind Apache, or whatever HTTP servers, e

Re: [rspec-users] private methode

2008-10-10 Thread Yi Wen
IMHO, one should never directly test a private method. So I prefer the second way you mentioned in your email. Better yet, think of why you want to test a private method. Is it too complicated? If this is the case, way too often this private method should not really belong to the class it's curren

Re: [rspec-users] How to unit test code that connects to the external resources?

2008-09-08 Thread Yi Wen
= http.request(req) } end run_path and use_ssl_for_run are both instance methods. run On Mon, Sep 8, 2008 at 3:23 PM, Chuck Remes <[EMAIL PROTECTED]> wrote: > > On Sep 8, 2008, at 12:12 PM, Yi Wen wrote: > > By external resources, I mean, the code start a http connection and G

[rspec-users] How to unit test code that connects to the external resources?

2008-09-08 Thread Yi Wen
By external resources, I mean, the code start a http connection and GET xmls from the url specified. I will definitely not rely my unit test on an external url or anything like that. But how do I unit test the method? I mean, I can basically mock the Net::HTTP, but then the test will pretty much be

Re: [rspec-users] Colorize story output

2008-07-08 Thread Yi Wen
Actually, for the completeness. please see this: http://yiwenandsoftware.wordpress.com/2008/06/25/intergrate-rspec-story-runner-in-cruisecontrolrb-build-with-html-report/ On Tue, Jul 8, 2008 at 8:59 AM, Yi Wen <[EMAIL PROTECTED]> wrote: > yes. -f html > > > On Tue, Jul 8, 200

Re: [rspec-users] Colorize story output

2008-07-08 Thread Yi Wen
yes. -f html On Tue, Jul 8, 2008 at 8:41 AM, aidy lewis <[EMAIL PROTECTED]> wrote: > Hi David, > > > > > > > > ruby stories/all.rb -c > > > > Fantastic. Is it possible to create HTML from this? > > Aidy > ___ > rspec-users mailing list > rspec-users@rub

Re: [rspec-users] auto-generated descriptions

2008-07-05 Thread Yi Wen
+1. This is a smart. On Fri, Jul 4, 2008 at 9:18 PM, Steve Eley <[EMAIL PROTECTED]> wrote: > On Fri, Jul 4, 2008 at 4:45 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: >> >> So - how bad do you think this would suck to remove that feature? Are you >> using it yourself? > > I'm not, but would it be

[rspec-users] DRY up story

2008-06-24 Thread Yi Wen
In David's presentation @ RailsConf, he has this example: Story: measure progress towards registration goals As a conference organizer I want to see a report of registrations So that I can measure progress towards registration goals Scenario: one registration shows as 1% Given a goal of 200 regis

[rspec-users] Story HTML output

2008-06-24 Thread Yi Wen
Hi, If I write the HTML format stories output to ~/ccrb_build-build_number/Stories/index.html. To get all styles rendered, I also need to copy /vendor/plugins/rspec/story_server/prototype/stylesheets/ and /vendor/plugins/rspec/story_server/prototype/javascripts/ to the ~/ccrb_build-build_number/St

Re: [rspec-users] before_save model callback rspec testing

2008-06-24 Thread Yi Wen
That's because you executed the same creation code into the script/console, which has nothing to do with RSpec, and still get the same error message, right? Yi On Tue, Jun 24, 2008 at 2:56 AM, Csongor Bartus <[EMAIL PROTECTED]> wrote: > Yi Wen wrote: >> Well, at least now we

Re: [rspec-users] before_save model callback rspec testing

2008-06-23 Thread Yi Wen
:26 AM, Csongor Bartus <[EMAIL PROTECTED]> wrote: > Yi Wen wrote: >> You don't have attr_accessor :password, :password_confirmation in >> User, do you? You may want to add this and try again > > I had :password, I've added :password_confirmation but still th

Re: [rspec-users] before_save model callback rspec testing

2008-06-23 Thread Yi Wen
You don't have attr_accessor :password, :password_confirmation in User, do you? You may want to add this and try again On Mon, Jun 23, 2008 at 9:59 AM, Csongor Bartus <[EMAIL PROTECTED]> wrote: > Yi Wen wrote: >> fire up script/console and copy line 82 and try it out. and

Re: [rspec-users] before_save model callback rspec testing

2008-06-23 Thread Yi Wen
fire up script/console and copy line 82 and try it out. and report the result here. On Fri, Jun 20, 2008 at 11:11 AM, Csongor Bartus <[EMAIL PROTECTED]> wrote: > David Chelimsky wrote: > >> >> Try using create! or save! - I'll bet the record is not being saved >> correctly and you're not seeing th

Re: [rspec-users] before_save model callback rspec testing

2008-06-20 Thread Yi Wen
user.should_receive(:encrypt_password).with(your_password) user.save Is this what you want? On Fri, Jun 20, 2008 at 10:12 AM, Csongor Bartus <[EMAIL PROTECTED]> wrote: > hi all, > > i'm learning rspec and i can't figure out how to test if a callback is > executed in a model. > > my model code is:

Re: [rspec-users] RSpec for testing REST webservices? (Not Rails)

2008-06-06 Thread Yi Wen
I use http-access2 (http://dev.ctor.org/http-access2) for make requests. I also have a custom WebServiceExampleGroup to do setup work there. On Fri, Jun 6, 2008 at 11:20 AM, Pol Llovet <[EMAIL PROTECTED]> wrote: > I am interested in this also, anyone out there have some best practices? > > -- > Po

Re: [rspec-users] RailsExampleGroup

2008-05-23 Thread Yi Wen
on web services. What's the "standard way" of doing it? Yi On 23 May 2008, at 19:53, Yi Wen wrote: > It's not in the database. It looks to me the data is not actually > inserted into the DB at all, just somehow buffered somewhere. It's stored in a transaction, so

[rspec-users] RailsExampleGroup

2008-05-23 Thread Yi Wen
So I have a describe which is a subclass of RailsExampleGroup. I inserted some data into my database, and reconnect! my connection. Before reconnect, finding the data I just created is fine. The data cannot be found, after reconnection, the data is gone. It's not in the database. It looks to me the