Re: [rspec-users] Too Clever?

2008-10-23 Thread aslak hellesoy
On Thu, Oct 23, 2008 at 7:20 PM, Michael Latta <[EMAIL PROTECTED]> wrote: > It appears we were too clever, but I think this would be a reasonable use of > stories. > > We tried to have a story file run with 2 different sets of steps to use the > same story against both the UI using selenium and aga

Re: [rspec-users] Surprising mock behavior

2008-10-23 Thread Mark Thomson
Pat Maddox wrote: Can you please post an example of the spec and production code that isn't behaving as you expect? Pat Sure, sorry been tied up with business travel this week. Here's my controller... class SubscribersController < ApplicationController def test file = File.ne

[rspec-users] Correct way to spec partials

2008-10-23 Thread Oleksandr Rudyk
Hi everybody, 1) Does anybody have full working example of how to test partial templates? 2) What the correct place to test partials: controller or view spec? If controller correct place, should I use integrate_views? 3) Is it true that expect_render is deprecated and I have to use should_receive

Re: [rspec-users] Too Clever?

2008-10-23 Thread aslak hellesoy
On Thu, Oct 23, 2008 at 11:20 PM, Michael Latta <[EMAIL PROTECTED]> wrote: > That works when running one at a time. When I want to run all my specs how > do I ensure the requires are applied to the appropriate features? It is not > all my stories, only a subset that are dual-purposed. Do I need

[rspec-users] Autospec running over and over, without changes?

2008-10-23 Thread Scott Burton
Hi all; I have several Rails projects where RSpec is working correctly, and one in which it is not. Running autospec continuously reloads all files, running my tests over and over again, without making any changes. Each time it reloads, it runs a smaller subset of specs until it settles a

Re: [rspec-users] Too Clever?

2008-10-23 Thread Michael Latta
That works when running one at a time. When I want to run all my specs how do I ensure the requires are applied to the appropriate features? It is not all my stories, only a subset that are dual- purposed. Do I need to have directories for those that can be run dual mode and those that ar

Re: [rspec-users] Specing protected methods

2008-10-23 Thread Avdi Grimm
On Thu, Oct 23, 2008 at 5:00 PM, Avdi Grimm <[EMAIL PROTECTED]> wrote: > FWIW, I blogged my answer to this question recently: > http://avdi.org/devblog/2008/10/21/testing-private-methods/ ...and to be a little more concrete, at first glance the way I'd apply that advice to your code example is to

Re: [rspec-users] Specing protected methods

2008-10-23 Thread Avdi Grimm
On Thu, Oct 23, 2008 at 5:16 AM, Bastien <[EMAIL PROTECTED]> wrote: > Hi everyone, > Do anyone know if there's a way to spec protected methods ? > Thanks in advance FWIW, I blogged my answer to this question recently: http://avdi.org/devblog/2008/10/21/testing-private-methods/ -- Avdi Home: htt

Re: [rspec-users] RSpec 1.1.9 on JRuby

2008-10-23 Thread Ashley Moran
On Oct 23, 2008, at 2:58 pm, David Chelimsky wrote: For rspec-1.1.9 you have to be on rubygems 1.3 to avoid those dependencies (as they are developer deps and I just used hoe to create the gemspec, which makes them normal deps for rubygems <= 1.2). I'll make sure that dep is not there for the

Re: [rspec-users] Too Clever?

2008-10-23 Thread Zach Dennis
On Thu, Oct 23, 2008 at 1:20 PM, Michael Latta <[EMAIL PROTECTED]> wrote: > It appears we were too clever, but I think this would be a reasonable use of > stories. > > We tried to have a story file run with 2 different sets of steps to use the > same story against both the UI using selenium and aga

[rspec-users] Too Clever?

2008-10-23 Thread Michael Latta
It appears we were too clever, but I think this would be a reasonable use of stories. We tried to have a story file run with 2 different sets of steps to use the same story against both the UI using selenium and against the server API using regular get/put/post. This way we could spec the

Re: [rspec-users] Specing protected methods

2008-10-23 Thread David Chelimsky
On Thu, Oct 23, 2008 at 10:00 AM, Bastien <[EMAIL PROTECTED]> wrote: > Thanks for all your answers. > > I was just wondering how about using send in my specs ? It would > bypass the protected limitation without altering my code : > > @survey.send( :sub_total, [EMAIL PROTECTED] ) > > Is that the kin

Re: [rspec-users] Specing protected methods

2008-10-23 Thread Bastien
Thanks for all your answers. I was just wondering how about using send in my specs ? It would bypass the protected limitation without altering my code : @survey.send( :sub_total, [EMAIL PROTECTED] ) Is that the kind of trickery you were referring to David ? Would that be bad practice ? Regards

Re: [rspec-users] RSpec 1.1.9 on JRuby

2008-10-23 Thread David Chelimsky
On Thu, Oct 23, 2008 at 7:43 AM, Ashley Moran <[EMAIL PROTECTED]> wrote: > Hi > > Can you use RSpec 1.1.9 on JRuby? Now it depends on spicycode-rcov, I can't > install it: > > # jgem install rspec --development > Building native extensions. This could take a while... > ERROR: Error installing rsp

Re: [rspec-users] Specing protected methods

2008-10-23 Thread David Chelimsky
On Thu, Oct 23, 2008 at 6:49 AM, Bastien <[EMAIL PROTECTED]> wrote: > I totally agree with the ''listening to your specs" concepts and > always divide my code into small methods easier to spec. > Now let me get you right, here's my code : > > class Survey < ActiveRecord::Base > has_many :participa

Re: [rspec-users] Specing protected methods

2008-10-23 Thread Pat Maddox
Bastien <[EMAIL PROTECTED]> writes: > I totally agree with the ''listening to your specs" concepts and > always divide my code into small methods easier to spec. > Now let me get you right, here's my code : > > class Survey < ActiveRecord::Base > has_many :participants > ... > def generate_r

Re: [rspec-users] How to Spec a Module to be used in a Controller

2008-10-23 Thread Pat Maddox
Matt Wynne <[EMAIL PROTECTED]> writes: > I want to be able to factor out bits of a controller's behaviour into > modules, and spec them independently. E.g. modules like Authentication > and ExceptionHandling that are mixed into ApplicationController. > > In my spec, I create a FakeController class

Re: [rspec-users] Specing protected methods

2008-10-23 Thread Craig Demyanovich
On Thu, Oct 23, 2008 at 7:49 AM, Bastien <[EMAIL PROTECTED]> wrote: > I m already specing the "generate_reports" methods with a mock on > "sub_total", but I would also like to spec that method. I've put this > method into protected because it doesn't make sens to call it from > outside this class.

Re: [rspec-users] How to Spec a Module to be used in a Controller

2008-10-23 Thread Stephen Eley
On Thu, Oct 23, 2008 at 7:00 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: > > This is working OK, but I'm struggling with the routing so that I can use > the integration session #get method to spin up my FakeController. Is that strictly necessary? Your fake controller's never going to get routed to

[rspec-users] RSpec 1.1.9 on JRuby

2008-10-23 Thread Ashley Moran
Hi Can you use RSpec 1.1.9 on JRuby? Now it depends on spicycode-rcov, I can't install it: # jgem install rspec --development Building native extensions. This could take a while... ERROR: Error installing rspec: ERROR: Failed to build gem native extension. /opt/local/share/java/jr

Re: [rspec-users] Specing protected methods

2008-10-23 Thread Bastien
I totally agree with the ''listening to your specs" concepts and always divide my code into small methods easier to spec. Now let me get you right, here's my code : class Survey < ActiveRecord::Base has_many :participants ... def generate_reports ... sub_total = sub_total(participant

[rspec-users] How to Spec a Module to be used in a Controller

2008-10-23 Thread Matt Wynne
I want to be able to factor out bits of a controller's behaviour into modules, and spec them independently. E.g. modules like Authentication and ExceptionHandling that are mixed into ApplicationController. In my spec, I create a FakeController class which inherits from ActionController::Bas

Re: [rspec-users] Specing protected methods

2008-10-23 Thread Matt Wynne
On 23 Oct 2008, at 10:16, Bastien wrote: Hi everyone, Do anyone know if there's a way to spec protected methods ? Thanks in advance Sorry if this sounds preachy, but I would always advise you to factor out the code in the method into another class, then test that class. If the behaviour of

[rspec-users] Specing protected methods

2008-10-23 Thread Bastien
Hi everyone, Do anyone know if there's a way to spec protected methods ? Thanks in advance -- Bastien ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users