Re: [rspec-users] How to test update_attribute with mocha?

2009-05-13 Thread Matt Wynne
On 14 May 2009, at 05:01, Phlip wrote: anmaxp wrote: I'm having sort of an issue here, I'm trying to test the update of the last_login field upon login, here is my test it "assigns a new last_login timestamp" do User.expects(:update_attribute).at_least_once.returns(true) User.any_inst

Re: [rspec-users] rake spec loads development environment

2009-05-13 Thread Mark Wilden
On Tue, Aug 19, 2008 at 2:35 PM, Jonathan Linowes wrote: > >rake spec RAILS_ENV=production > > that way the db:test:prepare uses the production db rather than the > development one I know this thread is long dead but ... you must be joking. ///ark ___

Re: [rspec-users] How to test update_attribute with mocha?

2009-05-13 Thread Phlip
anmaxp wrote: I'm having sort of an issue here, I'm trying to test the update of the last_login field upon login, here is my test it "assigns a new last_login timestamp" do User.expects(:update_attribute).at_least_once.returns(true) User.any_instance.expects(:update_attribute).with(:fie

Re: [rspec-users] rake spec loads development environment

2009-05-13 Thread David Chelimsky
On Wed, May 13, 2009 at 9:59 PM, Matthew Isleb wrote: > I know this thread is long dead, but I'm finding that I have the same > problem. 'rake spec:modles' loads the development environment and > clobbers my development database. I have to run set RAILS_ENV=test in > order for the tests to run cor

Re: [rspec-users] rake spec loads development environment

2009-05-13 Thread Matthew Isleb
I know this thread is long dead, but I'm finding that I have the same problem. 'rake spec:modles' loads the development environment and clobbers my development database. I have to run set RAILS_ENV=test in order for the tests to run correctly. Commenting out that rake task line does not solve t

[rspec-users] How to test update_attribute with mocha?

2009-05-13 Thread anmaxp
Hey everyone, I'm having sort of an issue here, I'm trying to test the update of the last_login field upon login, here is my test it "assigns a new last_login timestamp" do User.expects(:update_attribute).at_least_once.returns(true) post :create, :email => 'b...@example.com', :password

Re: [rspec-users] Unable to post to an update action in a controller spec

2009-05-13 Thread BJ Clark
On May 13, 2009, at 1:42 PM, Fernando Perez wrote: Hi, I use restful routes. In one of my views I have a form that looks like: <%- form_tag '/items/update', :method => :put do -%> ... <%= submit_tag "Recalculate" %> <%- end -%> I know I cheated a bit, as I should be submitting to /items

[rspec-users] Unable to post to an update action in a controller spec

2009-05-13 Thread Fernando Perez
Hi, I use restful routes. In one of my views I have a form that looks like: <%- form_tag '/items/update', :method => :put do -%> ... <%= submit_tag "Recalculate" %> <%- end -%> I know I cheated a bit, as I should be submitting to /items/1 instead. Anyway, now how can I trigger the update act

Re: [rspec-users] Options Hash explanation ?

2009-05-13 Thread mortench
On 13 Maj, 01:14, Randy Harmon wrote: > mortench wrote: > > The new rspec beta book and the rspec site mentions that it is > > possible to add a hash to "describe" and "it" constructs but very, > > very litle information about the particulars. > > > What can the options hash be used for and what s

Re: [rspec-users] Options Hash explanation ?

2009-05-13 Thread mortench
On 13 Maj, 07:28, David Chelimsky wrote: > You can access the group and example options from within an example: > > describe "group options hash", :defined_in => :group do >   it "is available in examples via self.class.options" do >     self.class.options[:defined_in].should == :group >   end > e

Re: [rspec-users] How To Drive Out AJAX Functionality in a Rails View

2009-05-13 Thread s.ross
Hi-- On May 13, 2009, at 12:47 AM, Lee wrote: I found a potential solution from this blog: http://www.rubytutorials.net/2008/02/29/small-rspec-revelations-rjs/ In my spec for the view in which I want to include the AJAX functionality ("new.html.erb_spec.erb"), I have added a couple of Examples

Re: [rspec-users] [RSpec] implicit receiver for should problem when helper predicate methods are in use

2009-05-13 Thread Jarmo Pertman
On May 13, 7:08 pm, David Chelimsky wrote: > > I actually think that what you're doing is perfectly fine. Just not > the common case. That's why I think it's OK to support explicitly > assigning self as subject, but not making that a default behaviour. > > If it were me, and it's *not*, but if i

Re: [rspec-users] [RSpec] implicit receiver for should problem when helper predicate methods are in use

2009-05-13 Thread David Chelimsky
On Wed, May 13, 2009 at 11:02 AM, Jarmo Pertman wrote: > On May 12, 6:21 am, David Chelimsky wrote: >> >> I don't want to promote using self as subject. I think being able to >> do so explicitly, as we can now with your previous patch, is perfectly >> reasonable. But doing so is a bit of a trick

Re: [rspec-users] [RSpec] implicit receiver for should problem when helper predicate methods are in use

2009-05-13 Thread David Chelimsky
On Wed, May 13, 2009 at 11:02 AM, Jarmo Pertman wrote: > On May 12, 6:21 am, David Chelimsky wrote: >> >> I don't want to promote using self as subject. I think being able to >> do so explicitly, as we can now with your previous patch, is perfectly >> reasonable. But doing so is a bit of a trick

Re: [rspec-users] [RSpec] implicit receiver for should problem when helper predicate methods are in use

2009-05-13 Thread Jarmo Pertman
On May 12, 6:21 am, David Chelimsky wrote: > > I don't want to promote using self as subject. I think being able to > do so explicitly, as we can now with your previous patch, is perfectly > reasonable. But doing so is a bit of a trick in my view, and runs > counter to the overall intent of the st

Re: [rspec-users] Rails HTML error page in the console.

2009-05-13 Thread Ben Mabey
Matt Wynne wrote: I'm still bugged by the fact that when I get an exception during a feature run (e.g. Couldn't find partial) then what I see in the console is all the HTML to report that error in a browser. I have had a few ideas for this bubbling around at the back of my mind. I wondered wh

Re: [rspec-users] Cucumber Tables

2009-05-13 Thread aslak hellesoy
> I am running into this situation: > > Feature 1 > >  Scenario A >    ... >    Then we should have currency exchange rates for "USD" on file >      And we should ... > > > Feature 2 > >  Scenario D >    ... >    Then we should have currency exchange rates for "USD" on file >        | code| >      

[rspec-users] Cucumber Tables

2009-05-13 Thread James Byrne
I am running into this situation: Feature 1 Scenario A ... Then we should have currency exchange rates for "USD" on file And we should ... Feature 2 Scenario D ... Then we should have currency exchange rates for "USD" on file | code| |"EUR"| |"

Re: [rspec-users] Can't use Cucumber with Webrat and Selenium

2009-05-13 Thread JDS
Well I can't help you but I do have a similar problem. In my case Cucumber-Selenium works, Cucumber-Webrat works but Cucmber-Webrat- Selenium doesn't work because Webrat issues requests to www.example.com and Selenium starts up a mongrel on localhost:3001, connects to it via Firefox and then throws

Re: [rspec-users] Rails HTML error page in the console.

2009-05-13 Thread Ben Lovell
On Wed, May 13, 2009 at 8:42 AM, Matt Wynne wrote: > I'm still bugged by the fact that when I get an exception during a feature > run (e.g. Couldn't find partial) then what I see in the console is all the > HTML to report that error in a browser. > > I have had a few ideas for this bubbling around

[rspec-users] Rails HTML error page in the console.

2009-05-13 Thread Matt Wynne
I'm still bugged by the fact that when I get an exception during a feature run (e.g. Couldn't find partial) then what I see in the console is all the HTML to report that error in a browser. I have had a few ideas for this bubbling around at the back of my mind. I wondered whether anyone els

Re: [rspec-users] How To Drive Out AJAX Functionality in a Rails View

2009-05-13 Thread Lee
I found a potential solution from this blog: http://www.rubytutorials.net/2008/02/29/small-rspec-revelations-rjs/ In my spec for the view in which I want to include the AJAX functionality ("new.html.erb_spec.erb"), I have added a couple of Examples to drive out the some of the AJAX functionality: