[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
Ok, I guess in reality it will never make a difference if a predicate returns a nil or a false. The behavior annoys me a little bit when I write a test that passes when the method itself does nothing (so that it returns nil). Any thoughts? Thanks Yi On Sep 18, 2009, at 11:06 AM, David

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
? returns nil Is this intended behavior or something I did was wrong? Thanks Yi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[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@rubyforg

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
5.7/bin/../lib/ spork/runner.rb:10:in `run' /usr/local/lib/ruby/gems/1.8/gems/timcharper-spork-0.5.7/bin/spork:11 /usr/local/bin/spork:19:in `load' /usr/local/bin/spork:19 It's missing application_controller. THe environment.rb is loaded before require 'spec/rails'. Any ide

Re: [rspec-users] Cucumber vs Rails Fixtures

2009-06-05 Thread Yi
I do this: Fixtures.reset_cache fixtures_folder = File.join(RAILS_ROOT, 'test', 'fixtures') fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') } fixture_class_names = {} # or whatever needed Fixtures.create_fixtures(fixtures_folder, fixtures, fixture_class_names)

[rspec-users] flash.now

2009-03-27 Thread Yi
Hi, How can I test flash.now[:key] is being set in a controller test? Both flash[:key] and flash.now[:key].should == message didn't work I can use response.session["flash"][:key].should == message . Just looks bad Thanks Yi -- http://yiwenandsoftwar

Re: [rspec-users] [Cucumber 0.2] Failure to use should

2009-03-25 Thread Yi
Just did a little bit exploration. Found out http://github.com/carlosbrando/remarkable/tree/master plugin I use actually cause the problem. This plugin also broke spec:server:start rake task as well. :-( On Thu, Mar 19, 2009 at 5:03 PM, Yi wrote: > I thought be_something is actually handled

Re: [rspec-users] [Cucumber 0.2] Failure to use should

2009-03-19 Thread Yi
I thought be_something is actually handled by rspec class Be. be_blank essentially asks the object blank? predicate. Not that there is a "be_blank" method declared anywhere. Anyway, require 'spec/expectations' doesn't solve the problem. I will look into this. Thanks Yi

Re: [rspec-users] [Cucumber 0.2] Failure to use should

2009-03-19 Thread Yi
re 'webrat/core/matchers' The only thing different is: config.application_address= "myapp.local" I tried to comment out this line and it didn't help anyway. I did script/generate cucumber and it didn't help. :( Yi 2009/3/19 aslak hellesoy > > > 2009/3/19 Yi

[rspec-users] [Cucumber 0.2] Failure to use should

2009-03-19 Thread Yi
undefined method `be_blank' for # (NoMethodError) features/create_account.feature:10:in `And the account should be created' I print out the account class, which is a AR::B. Why cucumber tells me it is a ActionController::Integration::Session? I use cucumber 0.2 and rspec 1.2 with Ra

[rspec-users] extra spec

2009-03-18 Thread Yi
Hi, If I do something like this: before(:each) do @test_class = Class.new do blahblah end end I will get one extra test shown: MyTest - test_class Where did I go wrong for this? Thanks Yi -- http://yiwenandsoftware.wordpress.com

Re: [rspec-users] route_for

2009-03-08 Thread Yi
David, thanks very much Yi On Sun, Mar 8, 2009 at 10:45 PM, David Chelimsky wrote: > On Sun, Mar 8, 2009 at 10:21 PM, David Chelimsky > wrote: > > On Sun, Mar 8, 2009 at 10:15 PM, David Chelimsky > wrote: > >> On Sun, Mar 8, 2009 at 9:49 PM, Yi wrote: > >>

[rspec-users] route_for

2009-03-08 Thread Yi
oller"=>"users"}>, difference: <{"action"=>"destroy"}> But assert_generates from rails works fine. I myself never used route_for helper before. So I am not sure is this is the problem of the method, or restful_authentication author misused it, or rails 2.3RC2 breaks it. Thanks Yi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Webrat - Fill in text field by id

2009-03-06 Thread Yi
Could you just try it? On Fri, Mar 6, 2009 at 1:22 PM, Steve Molitor wrote: > Well I'm reading the 0.4.2 webrat rdoc for fill_in, at it says: > "field can be either the value of a name attribute (i.e. user[email]) or > the text inside a element that points at the field." > > Does it also try the

Re: [rspec-users] Webrat - Fill in text field by id

2009-03-06 Thread Yi
It does take id. At least in the trunk webrat On Fri, Mar 6, 2009 at 10:23 AM, Steve Molitor wrote: > Is there a way to locate and 'fill in' a text field (or check a check box, > select an option, etc.) by id? It seems that the fill_in method takes > either the text of the label pointing to the

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

2009-03-04 Thread Yi
Great writing. Thanks On Wed, Mar 4, 2009 at 5:25 AM, Dan North wrote: > 2009/2/24 aslak hellesoy > >> On Tue, Feb 24, 2009 at 10:30 AM, Rob Holland >> wrote: >> > On Tue, Feb 24, 2009 at 9:17 AM, Matt Wynne wrote: >> > >> >> You can even use git commit --amend to commit on red (e.g at the en

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@rubyforg

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
cucumber test remains broken. What do we do then? We cannot check in any code because that'll break the build. So we can only checkin code after several days? It doesn't sound right to me. Any takes on this issue? Thanks in advance. Yi ___ r

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
m not a huge fan of "spec contract" for unit testing. Unit testing is a tool for developers to write better, DRY-er and more loosely-coupled code. At most it is a communication tool among developers. It's never meant to be for non-technical / clients / business people. Cucumber might serve

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
wrong? Thanks for helping. Yi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

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

2009-02-06 Thread Yi Wen
the state of things today." And I haven't seen any update on this issue since then. But according to this site <http://isitruby19.com/rspec>, RSpec works under Ruby 1.9. So Is there any "official" response on this issue? Thanks Yi __

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
belongs to Service layer though. Yi On Thu, Dec 11, 2008 at 5:48 AM, Andrew Premdas wrote: > Looking at generated controller specs we tend to get something like > > describe PostsController do > describe "handling GET /posts" do > > before(:each) do >

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

2008-11-18 Thread Yi Wen
Scenario lacks a "line" argument when calling add_scenario Yi On Tue, Nov 18, 2008 at 3:16 PM, Bret Pettichord <[EMAIL PROTECTED]>wrote: > I am trying to get some old "rbehave" scripts working with cucumber. I am > running into an error. I get the same error when I

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

2008-11-17 Thread Yi Wen
tant Spec::Rake /home/ywen/projects/kod/Rakefile:10 (See full trace by running task with --trace) Thanks yi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

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
ic in that class and you can unit testing this new public method. Yi On Fri, Oct 10, 2008 at 2:40 PM, Anita Anita <[EMAIL PROTECTED]> wrote: > Hi, > > Can I test private methods directly? > Or should I pass by the methods that are calling these private methods? > Or can

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
be like the method itself, except all the calls will be replaced by stub! or should_receive. I made this method as simple as possible. There is no *if* statements or loop in the method, should I just NOT test this one? Thanks for any ideas Yi ___ rspec

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
Does it possible to DRY up it a little bit by putting Given up to right after Story part? Or it is just too crazy? Yi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] Story HTML output

2008-06-24 Thread Yi Wen
/Stories/. Just wonder is this the right way to do it? or there is a better/preferred way? Thanks Yi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

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
to me the data is not actually inserted into the DB at all, just somehow buffered somewhere. Would anybody know why? thanks. Now the workaround is to have a separate class doing all DB operations, but I am still curious why RSpec does this, for speed reason