Re: [rspec-users] Testing User Agent

2009-02-25 Thread Suprie Leonhart
On Thu, Feb 26, 2009 at 12:08 PM, Nick Hoffman wrote: > On 25/02/2009, at 9:49 PM, Suprie Leonhart wrote: > >> On Thu, Feb 26, 2009 at 4:39 AM, Nick Hoffman >> wrote: >> >> Hi Suprie. AFAIK, RSpec populates the "request" object in your specs after >> a controller action is called. Since your "sh

Re: [rspec-users] [cucumber] orphaned steps

2009-02-25 Thread Aslak Hellesøy
Any good way to find all orphaned steps? That is, any steps that exist that do not match any features? You can use RCov. Aslak Many thanks, Tim ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-u

Re: [rspec-users] Testing User Agent

2009-02-25 Thread Nick Hoffman
On 25/02/2009, at 9:49 PM, Suprie Leonhart wrote: On Thu, Feb 26, 2009 at 4:39 AM, Nick Hoffman wrote: Hi Suprie. AFAIK, RSpec populates the "request" object in your specs after a controller action is called. Since your "should know if it's from blackberry" example doesn't call a controll

Re: [rspec-users] Testing User Agent

2009-02-25 Thread Suprie Leonhart
On Thu, Feb 26, 2009 at 4:39 AM, Nick Hoffman wrote: > > Hi Suprie. AFAIK, RSpec populates the "request" object in your specs after > a controller action is called. Since your "should know if it's from > blackberry" example doesn't call a controller action, the "request" object > is nil. > -Nick

Re: [rspec-users] Testing User Agent

2009-02-25 Thread Suprie Leonhart
On Wed, Feb 25, 2009 at 10:45 PM, David Chelimsky wrote: > On Wed, Feb 25, 2009 at 3:51 AM, Suprie Leonhart > wrote: > > > > > > On Wed, Feb 25, 2009 at 4:19 PM, David Chelimsky > > wrote: > >> > >> On Wed, Feb 25, 2009 at 1:57 AM, Suprie Leonhart > >> wrote: > >> > hi > >> > > >> > i'm testing

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

2009-02-25 Thread David Chelimsky
On Wed, Feb 25, 2009 at 7:48 PM, George Anderson wrote: > Thanks, David.  That was a good call. > > I had these installed: > > dchelimsky-rspec (1.1.11.1) > dchelimsky-rspec-rails (1.1.11.1) Glad you got it resolved. Cheers, David > > They were getting picked up instead of the new 1.1.99.9 gems

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

2009-02-25 Thread George Anderson
Thanks, David. That was a good call. I had these installed: dchelimsky-rspec (1.1.11.1) dchelimsky-rspec-rails (1.1.11.1) They were getting picked up instead of the new 1.1.99.9 gems. Once I uninstalled them, everything worked. Thanks again. I appreciate the support. /g -- George Anderson

Re: [rspec-users] How to mock an object defined in the before_filter function?

2009-02-25 Thread Pat Maddox
On Wed, Feb 25, 2009 at 2:40 PM, Evgeny Bogdanov wrote: > The function to specify and specification for it are below. > > Comment.stub!(:find).and_return(@comment) > does what I need. > However, it strongly depends on the implementation of find_comment > function, > and if I change it to, let's sa

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 > > is the only error. no stack trace. > >

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

2009-02-25 Thread Yi Wen
I haven't looked into it too much. But I believe it is because I implemented method_missing and respond_to?, which probably conflicts with RSpec's imlementations. I have been wanting to re-implement my functionality in another way other than method_missing for a long time. It seems now is the perfe

[rspec-users] [cucumber] orphaned steps

2009-02-25 Thread Tim Walker
Any good way to find all orphaned steps? That is, any steps that exist that do not match any features? Many thanks, Tim ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

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

2009-02-25 Thread Mark Wilden
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 > is the only error. no stack trace. >         presenter.stub!(:account).and_return account > any idea? Thanks > Yi > > ___ > rs

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

2009-02-25 Thread David Chelimsky
On Wed, Feb 25, 2009 at 4:37 PM, George Anderson wrote: >> Is something in your app is requiring version 1.1.11.1 in specific? > > Negative. > > That was my thought too, but no such requirement exists. Gotta be coming from somewhere. May not be in your app, but something somewhere on your machine

Re: [rspec-users] [Cucumber] pretty html output?

2009-02-25 Thread Phlip
Ben Mabey wrote: And could we make it ... cucumber colored? like cucumber.css probably does? (-: cucumber.css? Is that what cucumber uses for it's HTML formatter? I'm sure you could. I would recommend starting with the github css I have in the project and use Firebug/Webdeveloper to chang

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

2009-02-25 Thread David Chelimsky
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 trace. try running with --backtrace >         presenter.stub!(:account).and_return account > any idea? Thanks > Yi > > _

[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] How to mock an object defined in the before_filter function?

2009-02-25 Thread Evgeny Bogdanov
The function to specify and specification for it are below. Comment.stub!(:find).and_return(@comment) does what I need. However, it strongly depends on the implementation of find_comment function, and if I change it to, let's say, this one: def find_comment @space = Space.find(1)

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

2009-02-25 Thread George Anderson
> Is something in your app is requiring version 1.1.11.1 in specific? Negative. That was my thought too, but no such requirement exists. /g -- George Anderson BenevolentCode LLC O: (410) 461-7553 C: (410) 218-5185 geo...@benevolentcode.com On Wed, Feb 25, 2009 at 5:29 PM, David Chelimsky w

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

2009-02-25 Thread David Chelimsky
On Wed, Feb 25, 2009 at 3:53 PM, George Anderson wrote: > I pulled both repos and tried 'rake gem' but got 'permission denied' > 'sudo rake gem' worked: > > ~/work/rspec (master) $ rake gem > (in /Users/george/work/rspec) > /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13

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

2009-02-25 Thread George Anderson
I pulled both repos and tried 'rake gem' but got 'permission denied' 'sudo rake gem' worked: ~/work/rspec (master) $ rake gem (in /Users/george/work/rspec) /opt/local/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or a

Re: [rspec-users] How to properly mock a complex object "comment.initiator.group.name"?

2009-02-25 Thread Evgeny Bogdanov
Thanks a lot! Got an idea! On Feb 25, 11:35 am, Pat Maddox wrote: > On Wed, Feb 25, 2009 at 2:13 AM, Evgeny Bogdanov > > > > wrote: > > I am wondering what is the best way to mock such expression: > > "comment.initiator.group.name" > > > What I do now is: > > === > > comm

Re: [rspec-users] Testing User Agent

2009-02-25 Thread Nick Hoffman
On 25/02/2009, at 4:51 AM, Suprie Leonhart wrote: On Wed, Feb 25, 2009 at 4:19 PM, David Chelimsky wrote: On Wed, Feb 25, 2009 at 1:57 AM, Suprie Leonhart wrote: > hi > > i'm testing some lib i've made for detecting mobile user agent, I confused > how to test the lib i've made. > the test

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

2009-02-25 Thread David Chelimsky
On Wed, Feb 25, 2009 at 2:35 PM, George Anderson wrote: > >From David: > We're up to 1.1.99.9 now - have you tried that? > > Sorry, yes, I meant 1.1.99.1. > > ~/work/rspec (master) $ gem list rspec > > *** LOCAL GEMS *** > > rspec (1.1.99.9) > rspec-rails (1.1.99.9) > > > This is what I did: > > c

Re: [rspec-users] [Cucumber] pretty html output?

2009-02-25 Thread Ben Mabey
Phlip wrote: Ben Mabey wrote: http://github.com/bmabey/cucumber-pygments-lexer/tree/master You can get something like: http://www.benmabey.com/cucumber_on_github.html Nice! Will use! And could we make it ... cucumber colored? like cucumber.css probably does? (-: cucumber.css? Is that w

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

2009-02-25 Thread George Anderson
>From David: > We're up to 1.1.99.9 now - have you tried that? Sorry, yes, I meant 1.1.99.1. ~/work/rspec (master) $ gem list rspec *** LOCAL GEMS *** rspec (1.1.99.9) rspec-rails (1.1.99.9) This is what I did: cloned: git://github.com/dchelimsky/rspec.git rake gem rake install_gem cloned:

Re: [rspec-users] [Cucumber] pretty html output?

2009-02-25 Thread Phlip
Ben Mabey wrote: http://github.com/bmabey/cucumber-pygments-lexer/tree/master You can get something like: http://www.benmabey.com/cucumber_on_github.html Nice! Will use! And could we make it ... cucumber colored? like cucumber.css probably does? (-:

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

2009-02-25 Thread David Chelimsky
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://github.com/dchelimsky/rspec-rails and > http://github.com/dchelimsky/rspec), b

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] pretty html output?

2009-02-25 Thread Ben Mabey
Phlip wrote: Cucumberists (and RSpec Classic users ;): How can we convert a Cucumber feature file into HTML with syntax highlighting? Not the test-runner output; that's preprocessed so it does not match the input file... Tx! Using this: http://github.com/bmabey/cucumber-pygments-lexer/t

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

2009-02-25 Thread George Anderson
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://github.com/dchelimsky/rspec-rails and http://github.com/dchelimsky/rspec), but no luck. I realize "releases with a 4th partial [are] interim (u

Re: [rspec-users] Cucumber Feature Scenario critique

2009-02-25 Thread James Byrne
Andrew Premdas wrote: > James, > > Thanks for taking the time and providing more fodder to chew on. > > There are a couple of things I'd like to point out I will take a little time to digest this and perhaps to comment but, in the meantime, thank you for your thoughts on this matter. There is

Re: [rspec-users] Surprised by stub/mock interaction

2009-02-25 Thread David Chelimsky
On Wed, Feb 25, 2009 at 10:39 AM, Jeff Talbot wrote: > > > On Wed, Feb 25, 2009 at 10:23 AM, David Chelimsky > wrote: >> >> On Wed, Feb 25, 2009 at 10:10 AM, Jeff Talbot >> wrote: >> > Hello, >> > >> > Something I do often is use stub methods in before blocks and mock >> > expectations in a spec

Re: [rspec-users] Surprised by stub/mock interaction

2009-02-25 Thread Jeff Talbot
On Wed, Feb 25, 2009 at 10:23 AM, David Chelimsky wrote: > On Wed, Feb 25, 2009 at 10:10 AM, Jeff Talbot > wrote: > > Hello, > > > > Something I do often is use stub methods in before blocks and mock > > expectations in a specific examples (much like described here: > > http://blog.davidchelimsky

Re: [rspec-users] Cucumber Feature Scenario critique

2009-02-25 Thread Andrew Premdas
James, Thanks for taking the time and providing more fodder to chew on. There are a couple of things I'd like to point out Modelling the world is a futile and pointless task. Its to big and complicated. Model YOUR world instead, choose the external boundaries carefully and make your world as sim

[rspec-users] [Cucumber] pretty html output?

2009-02-25 Thread Phlip
Cucumberists (and RSpec Classic users ;): How can we convert a Cucumber feature file into HTML with syntax highlighting? Not the test-runner output; that's preprocessed so it does not match the input file... Tx! -- Phlip ___ rspec-users mailing

Re: [rspec-users] Surprised by stub/mock interaction

2009-02-25 Thread David Chelimsky
On Wed, Feb 25, 2009 at 10:10 AM, Jeff Talbot wrote: > Hello, > > Something I do often is use stub methods in before blocks and mock > expectations in a specific examples (much like described here: > http://blog.davidchelimsky.net/2006/11/9/tutorial-rspec-stubs-and-mocks). > > I was just surprised

[rspec-users] Surprised by stub/mock interaction

2009-02-25 Thread Jeff Talbot
Hello, Something I do often is use stub methods in before blocks and mock expectations in a specific examples (much like described here: http://blog.davidchelimsky.net/2006/11/9/tutorial-rspec-stubs-and-mocks). I was just surprised with an instance of doing this and I thought I'd check with the g

Re: [rspec-users] Testing User Agent

2009-02-25 Thread David Chelimsky
On Wed, Feb 25, 2009 at 3:51 AM, Suprie Leonhart wrote: > > > On Wed, Feb 25, 2009 at 4:19 PM, David Chelimsky > wrote: >> >> On Wed, Feb 25, 2009 at 1:57 AM, Suprie Leonhart >> wrote: >> > hi >> > >> > i'm testing some lib i've made for detecting mobile user agent, I >> > confused >> > how to t

Re: [rspec-users] [Cucumber] Enforce a skip on a non-implemented step

2009-02-25 Thread aidy lewis
Hi Josh et al On 25/02/2009, Josh Knowles wrote: > On Wed, Feb 25, 2009 at 5:52 AM, aidy lewis wrote: > > Hi, > > > > When we create step defintions. For example: > > > > When /^that data is loaded$/ do > > > > end > > > > Are you familiar with the "pending" method? > > i.e. > > > When /

Re: [rspec-users] specing send_file

2009-02-25 Thread David Chelimsky
On Wed, Feb 25, 2009 at 8:20 AM, vo.x wrote: > Aha, it seems that there is difference between behavior of Rails 2.1 > and 2.3. In Rails 2.1 stubbing works like a charm but it fails with > Rails 2.3 :/ That's a very general statement. Can you be more specific? What version of rspec are you using?

Re: [rspec-users] [Cucumber] Enforce a skip on a non-implemented step

2009-02-25 Thread Josh Knowles
On Wed, Feb 25, 2009 at 5:52 AM, aidy lewis wrote: > Hi, > > When we create step defintions. For example: > > When /^that data is loaded$/ do > > end Are you familiar with the "pending" method? i.e. When /^that data is loaded$/ pending end ___ rspe

Re: [rspec-users] specing send_file

2009-02-25 Thread vo.x
On 23 Ún, 17:30, Stephen Eley wrote: > On Fri, Feb 20, 2009 at 5:45 PM, vo.x wrote: > > Hello everybody! > > > Im wondering what is the best way of specing action with send file > > such as: > > I'd probably do it on two fronts.  On the unit test level, you can > stub it in your setup so that i

Re: [rspec-users] [Cucumber] Enforce a skip on a non-implemented step

2009-02-25 Thread Joseph Wilk
aidy lewis wrote: Hi, When we create step defintions. For example: When /^that data is loaded$/ do end The above is seen in the Cucucmber run as implemented. Is it possible to put something within this method to enforce a skip flag? Do you mean something like the 'pending' funct

Re: [rspec-users] [Cucumber] Enforce a skip on a non-implemented step

2009-02-25 Thread aslak hellesoy
On Wed, Feb 25, 2009 at 11:52 AM, aidy lewis wrote: > Hi, > > When we create step defintions. For example: > > When /^that data is loaded$/ do > > end > > The above is seen in the Cucucmber run as implemented. > > Is it possible to put something within this method to enforce a skip flag? > I'm no

[rspec-users] [Cucumber] Enforce a skip on a non-implemented step

2009-02-25 Thread aidy lewis
Hi, When we create step defintions. For example: When /^that data is loaded$/ do end The above is seen in the Cucucmber run as implemented. Is it possible to put something within this method to enforce a skip flag? Aidy ___ rspec-users maili

Re: [rspec-users] How to mock an object defined in the before_filter function?

2009-02-25 Thread Pat Maddox
Can you show your spec? I'm not sure why you're using assigns in the controller spec. David explained that it doesn't work like that. Your spec should look something like it "should destroy the record" do mock_comment = stub_model Comment Comment.stub!(:find).and_return mock_comment mock_c

Re: [rspec-users] How to properly mock a complex object "comment.initiator.group.name"?

2009-02-25 Thread Pat Maddox
On Wed, Feb 25, 2009 at 2:13 AM, Evgeny Bogdanov wrote: > I am wondering what is the best way to mock such expression: > "comment.initiator.group.name" > > What I do now is: > === > comment = mock_model(Comment) > initiator = mock_model(User) > group = mock_model(Group, :na

[rspec-users] How to properly mock a complex object "comment.initiator.group.name"?

2009-02-25 Thread Evgeny Bogdanov
I am wondering what is the best way to mock such expression: "comment.initiator.group.name" What I do now is: === comment = mock_model(Comment) initiator = mock_model(User) group = mock_model(Group, :name => "Admin") initiator.stub!(:group).and_return(group) comment.stub!(

Re: [rspec-users] How to mock an object defined in the before_filter function?

2009-02-25 Thread Evgeny Bogdanov
Thank you, David! One small follow-up question. Is there is a way to mock an object "@comment" in the controller_spec for the function? I didn't manage to do it. def destroy @destroy_id = @comment.id #to be used in rendering partial @comment.destroy end Looks like assigns[:comment] = mock

Re: [rspec-users] Testing User Agent

2009-02-25 Thread Suprie Leonhart
On Wed, Feb 25, 2009 at 4:19 PM, David Chelimsky wrote: > On Wed, Feb 25, 2009 at 1:57 AM, Suprie Leonhart > wrote: > > hi > > > > i'm testing some lib i've made for detecting mobile user agent, I > confused > > how to test the lib i've made. > > the test code is > > > > [code] > > > > describe

Re: [rspec-users] Testing User Agent

2009-02-25 Thread David Chelimsky
On Wed, Feb 25, 2009 at 1:57 AM, Suprie Leonhart wrote: > hi > > i'm testing some lib i've made for detecting mobile user agent, I confused > how to test the lib i've made. > the test code is > > [code] > >   describe "Check if mobile browser" do >     it "should know if it's from blackberry" do >

[rspec-users] Testing User Agent

2009-02-25 Thread Suprie Leonhart
hi i'm testing some lib i've made for detecting mobile user agent, I confused how to test the lib i've made. the test code is [code] describe "Check if mobile browser" do it "should know if it's from blackberry" do blackberry_ua = "BlackBerry8330/4.3.0 Profile/MIDP-2.0 Configuration/