[rspec-users] mocking named_scope utilization

2008-09-12 Thread Juanma Cervera
Hello,
I am having trouble to mock the chaining of named_scope in the
controller, also I would like to use will_paginate.

def index
  @things = Thing.allowed_for(@current_user).available.paginate :page =>
params[:page]
end

¿How to do it?
Thanks

Juanma Cervera
-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] cucumber gem install

2008-09-12 Thread aidy lewis
Hi,

I am having problem with the cucumber gem install

gem sources --add http://gems.github.com/
gem install aslakhellesoy-cucumber

=>

C:\>gem install aslakhellesoy-cucumber
ERROR:  While executing gem ... (Errno::ENOENT)
No such file or directory -
c:/ruby/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.1.5/bin/cucumber

I have created the folder manually, but I am getting a permissions denied error

ERROR:  While executing gem ... (Errno::EACCES)
Permission denied -
c:/ruby/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.1.5/bin/cucumber

I am allowed to write to the folder myself. Has anyone had the same
problem? I have set the company proxy.

I am on Windows Server 2003

Cheers

Aidy
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] cucumber gem install

2008-09-12 Thread aslak hellesoy
On Fri, Sep 12, 2008 at 1:52 PM, aidy lewis <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am having problem with the cucumber gem install
>
> gem sources --add http://gems.github.com/
> gem install aslakhellesoy-cucumber
>
> =>
>
> C:\>gem install aslakhellesoy-cucumber
> ERROR:  While executing gem ... (Errno::ENOENT)
>No such file or directory -
> c:/ruby/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.1.5/bin/cucumber
>
> I have created the folder manually, but I am getting a permissions denied 
> error
>

Several people have reported it. I'm investigating. Seems like a
Github problem actually.

Please get it with Git and build the gem yourself in the meanwhile.

Aslak

> ERROR:  While executing gem ... (Errno::EACCES)
>Permission denied -
> c:/ruby/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.1.5/bin/cucumber
>
> I am allowed to write to the folder myself. Has anyone had the same
> problem? I have set the company proxy.
>
> I am on Windows Server 2003
>
> Cheers
>
> Aidy
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


[rspec-users] mocking the shell command (Kernel module)

2008-09-12 Thread Joaquin Rivera Padron
hello there,
what is the best (or any) way of mocking the running of shell commands?

e.g.
code like the following:

%{ ls }

spec:

it "should list the directory contents"
  shell = mock(Object) # %{} lives in Kernel module and its sugar for `

end
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] mocking the shell command (Kernel module)

2008-09-12 Thread Joaquin Rivera Padron
ooop, sorry the last one goes out unfinished (some gmail hotkey)...

hello there,
what is the best (or any) way of mocking the running of shell commands?

e.g.
code like the following:

def method
  %{ ls }
end

spec:

it "should list the directory contents"
  shell = mock(Object) # %{} lives in Kernel module and its sugar for `
  shell.should_receive(:`).with(:ls)
end

sorry about latter one, thanks in advance
joaquin

2008/9/12 Joaquin Rivera Padron <[EMAIL PROTECTED]>

> hello there,
> what is the best (or any) way of mocking the running of shell commands?
>
> e.g.
> code like the following:
>
> %{ ls }
>
> spec:
>
> it "should list the directory contents"
>   shell = mock(Object) # %{} lives in Kernel module and its sugar for `
>
> end
>
>
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] mocking the shell command (Kernel module)

2008-09-12 Thread Matt Wynne

On 12 Sep 2008, at 14:12, Joaquin Rivera Padron wrote:

what is the best (or any) way of mocking the running of shell  
commands?


e.g.
code like the following:

def method
  %{ ls }
end

spec:

it "should list the directory contents"
  shell = mock(Object) # %{} lives in Kernel module and its sugar  
for `

  shell.should_receive(:`).with(:ls)
end

sorry about latter one, thanks in advance
joaquin


I suggest you put a 'seam' between your code and the call the Kernel.

See Pat's excellent answer to a similar question in this thread:
http://www.ruby-forum.com/topic/164893#new

cheers,
Matt

http://blog.mattwynne.net
http://songkick.com

In case you wondered: The opinions expressed in this email are my own  
and do not necessarily reflect the views of any former, current or  
future employers of mine.




___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread Damian Jones
This is my story:

require File.expand_path(File.dirname(__FILE__) + "/helper")

Story "Creating a Product", %{
As a User
I want to create a product
So that I can collect purchase options together under a specific
product

}, :type => RailsStory do

Scenario "User with create product permissions" do
Given "No products in the system" do
Product.destroy_all
end

When "I Post  to", "/products", :product =>
{:name => "Product
1", :description => "Product 1 description"} do |path, params|
post_via_redirect path, params
end

Then "show template should be rendered" do
response.should render_template("show")
end

And "the page should show", "Product 1" do
|text|
response.should have_text(/#{text}/)
end

And "the page should show", "Product 1
description"

And "Confirm the product was successfully saved"
end
end

and this is my create method(pretty standard)

   def create
@product = Product.new params[:product]
if @product.save
redirect_to product_url(@product)
else
render :action => :new
end
end

My specs confirm that 'show' template is rendered after successful
save but my story is failing here:

Then "show template should be rendered" do
response.should render_template("show")
end

saying expected 'show' got nil.

I am new to Ruby and am trying to start off in the right way, but this
is driving me nuts,  any one got any ideas?
-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] mocking the shell command (Kernel module)

2008-09-12 Thread Joaquin Rivera Padron
thanks,
I'll give that a try

joaquin

2008/9/12 Matt Wynne <[EMAIL PROTECTED]>

> On 12 Sep 2008, at 14:12, Joaquin Rivera Padron wrote:
>
> what is the best (or any) way of mocking the running of shell commands?
>
> e.g.
> code like the following:
>
> def method
>   %{ ls }
> end
>
> spec:
>
> it "should list the directory contents"
>   shell = mock(Object) # %{} lives in Kernel module and its sugar for `
>   shell.should_receive(:`).with(:ls)
> end
>
> sorry about latter one, thanks in advance
> joaquin
>
>
> I suggest you put a 'seam' between your code and the call the Kernel.
>
> See Pat's excellent answer to a similar question in this thread:
> http://www.ruby-forum.com/topic/164893#new
>
> cheers,
> Matt
> 
> http://blog.mattwynne.net
> http://songkick.com
>
> In case you wondered: The opinions expressed in this email are my own and
> do not necessarily reflect the views of any former, current or future
> employers of mine.
>
>
>
>
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 8:56 AM, Damian Jones <[EMAIL PROTECTED]> wrote:
> This is my story:
>
> require File.expand_path(File.dirname(__FILE__) + "/helper")
>
> Story "Creating a Product", %{
>As a User
>I want to create a product
>So that I can collect purchase options together under a specific
> product
>
> }, :type => RailsStory do
>
>Scenario "User with create product permissions" do
>Given "No products in the system" do
>Product.destroy_all
>end
>
>When "I Post  to", "/products", :product =>
> {:name => "Product
> 1", :description => "Product 1 description"} do |path, params|
>post_via_redirect path, params
>end
>
>Then "show template should be rendered" do
>response.should render_template("show")
>end
>
>And "the page should show", "Product 1" do
> |text|
>response.should have_text(/#{text}/)
>end
>
>And "the page should show", "Product 1
> description"
>
>And "Confirm the product was successfully saved"
>end
> end
>
> and this is my create method(pretty standard)
>
>   def create
>@product = Product.new params[:product]
>if @product.save
>redirect_to product_url(@product)
>else
>render :action => :new
>end
>end
>
> My specs confirm that 'show' template is rendered after successful
> save but my story is failing here:
>
>Then "show template should be rendered" do
>response.should render_template("show")
>end
>
> saying expected 'show' got nil.
>
> I am new to Ruby and am trying to start off in the right way, but this
> is driving me nuts,  any one got any ideas?

Stories don't provide access to internals like which template was
rendered. In this case, other steps are expecting text that's on the
resulting page. At a Story level, that's really all you need. You just
need to find the things on this particular page that will
differentiate it from other pages.

That make sense?
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] mocking named_scope use in controllers

2008-09-12 Thread Juanma Cervera
Maybe "utilization" is not correct an english word.
I'm not sure.
I would change the words in the subject

Juanma Cervera

-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] cucumber gem install

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 7:46 AM, aslak hellesoy
<[EMAIL PROTECTED]> wrote:
> On Fri, Sep 12, 2008 at 1:52 PM, aidy lewis <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I am having problem with the cucumber gem install
>>
>> gem sources --add http://gems.github.com/
>> gem install aslakhellesoy-cucumber
>>
>> =>
>>
>> C:\>gem install aslakhellesoy-cucumber
>> ERROR:  While executing gem ... (Errno::ENOENT)
>>No such file or directory -
>> c:/ruby/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.1.5/bin/cucumber
>>
>> I have created the folder manually, but I am getting a permissions denied 
>> error
>>
>
> Several people have reported it. I'm investigating. Seems like a
> Github problem actually.
>
> Please get it with Git and build the gem yourself in the meanwhile.

For anyone who's not sure about how to do that:

git clone git://github.com/aslakhellesoy/cucumber.git
cd cucumber
rake gem
rake install_gem

Cheers,
David

>
> Aslak
>
>> ERROR:  While executing gem ... (Errno::EACCES)
>>Permission denied -
>> c:/ruby/lib/ruby/gems/1.8/gems/aslakhellesoy-cucumber-0.1.5/bin/cucumber
>>
>> I am allowed to write to the folder myself. Has anyone had the same
>> problem? I have set the company proxy.
>>
>> I am on Windows Server 2003
>>
>> Cheers
>>
>> Aidy
>> ___
>> rspec-users mailing list
>> rspec-users@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] mocking named_scope utilization

2008-09-12 Thread Pat Maddox
On Fri, Sep 12, 2008 at 5:20 AM, Juanma Cervera <[EMAIL PROTECTED]> wrote:
> Hello,
> I am having trouble to mock the chaining of named_scope in the
> controller, also I would like to use will_paginate.
>
> def index
>  @things = Thing.allowed_for(@current_user).available.paginate :page =>
> params[:page]
> end
>
> ¿How to do it?
> Thanks

You're basically just going to have to chain some stubs.

@available = stub("available things", :paginate => [:thing])
@allowed_for = stub("allowed things", :available => @available)
Thing.stub!(:allowed_for).and_return @allowed_for

I would probably wrap that chain up in a method though, that expresses
what you want and makes it easier to stub

class Thing
  def self.available_to(user)
allowed_for(user).available
  end
end

This makes your test become

@available = stub("available things", :paginate => [:thing])
Thing.stub!(:available_to).and_return @available

and to mock it, you can do

Thing.should_receive(:allowed_for).with(mock_user).and_return @available

Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] mocking named_scope utilization

2008-09-12 Thread Juanma Cervera
Very clear.
Thank you very much Pat!


-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread Damian Jones
David

Are you saying this part should work:

And "the page should show", "Product 1" do |text|
 response.should have_text(/#{text}/)
end

because I'm getting nil for this step too.


-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread Pat Maddox
On Fri, Sep 12, 2008 at 10:58 AM, Damian Jones <[EMAIL PROTECTED]> wrote:
> David
>
> Are you saying this part should work:
>
> And "the page should show", "Product 1" do |text|
>  response.should have_text(/#{text}/)
> end
>
> because I'm getting nil for this step too.

Is the request actually completing successfully?  It seems like there
might be an exception that's preventing the page from rendering.

Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 10:01 AM, Pat Maddox <[EMAIL PROTECTED]> wrote:
> On Fri, Sep 12, 2008 at 10:58 AM, Damian Jones <[EMAIL PROTECTED]> wrote:
>> David
>>
>> Are you saying this part should work:
>>
>> And "the page should show", "Product 1" do |text|
>>  response.should have_text(/#{text}/)
>> end
>>
>> because I'm getting nil for this step too.
>
> Is the request actually completing successfully?  It seems like there
> might be an exception that's preventing the page from rendering.

That is what it sounds like.

Also - once you get this working, there is a general style/approach
issue that you may want to ponder - what you've got there will output
something like this:

Given No products in the system
When I Post  to
Then show template should be rendered
And the page should show
And the page should show
And Confirm the product was successfully saved

Obviously, this isn't that helpful as the arguments don't get
rendered. The approach you are taking has not really been recommended
for a while and will not be supported in Cucumber, which is probably
going to be replacing RSpec's Story Runner.

To make that transition easy for you, I'd recommend either moving to
cucumber now, or at least taking the "decoupled step definitions"
approach within Story Runner. Check out http://pastie.org/271244 (with
the steps, story and output) and let me know if it makes sense to you.

HTH,
David
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


[rspec-users] Cucumber Scenario syntax

2008-09-12 Thread Evan David Light
Last night, I gave a presentation to the DC Ruby Users Group (http://dcrug.org 
) on Plain Text Stories with Ruby.  I spoke on both RSpec Plain Text  
Stories, which I have used, and Cucumber which I started to dig into a  
couple of nights ago.  You can see the presentation here (http://evan.tiggerpalace.com/2008/09/11/plain-text-stories-at-dcrug/ 
) if that floats your boat.


You may also note in the linked blog entry that the general consensus  
at DCRUG (and my own feeling as well) is that Cucumber's scenario  
syntax perhaps assumes undue technical ignorance on the part of the  
scenario author(s).


It seems odd to me (and several DCRUGgers) that the hooks into the  
Scenario steps/substitution points are not apparent by reading the  
Scenario plain text.  That is, you have to read the Scenario step  
implementations to figure out where the hooks are in the Scenario  
plain text.


This seems somewhat wrong-headed.  As one DCRUGger said to me last  
night, we should at least assume that Scenario authors can handle a  
basic Excel spreadsheet.  That is, that the Scenario could contain the  
FIT table column headers so that the Scenarios serve as templates that  
are specialized by rows in the FIT table.  This seems more natural as  
the substitutions become far clearer just by looking at the plain text.


Disclaimer: My exposure to FIT is limited to a quick read of Ward  
Cunningham's page on FIT and Cucumber.


Evan
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread Pat Maddox
I agree.  Seems much more useful to me to think of the first one as
being a template that stuff gets plugged in to.

Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 10:35 AM, Evan David Light
<[EMAIL PROTECTED]> wrote:
> Last night, I gave a presentation to the DC Ruby Users Group
> (http://dcrug.org) on Plain Text Stories with Ruby.  I spoke on both RSpec
> Plain Text Stories, which I have used, and Cucumber which I started to dig
> into a couple of nights ago.  You can see the presentation here
> (http://evan.tiggerpalace.com/2008/09/11/plain-text-stories-at-dcrug/) if
> that floats your boat.
>
> You may also note in the linked blog entry that the general consensus at
> DCRUG (and my own feeling as well) is that Cucumber's scenario syntax
> perhaps assumes undue technical ignorance on the part of the scenario
> author(s).
>
> It seems odd to me (and several DCRUGgers) that the hooks into the Scenario
> steps/substitution points are not apparent by reading the Scenario plain
> text.  That is, you have to read the Scenario step implementations to figure
> out where the hooks are in the Scenario plain text.
>
> This seems somewhat wrong-headed.  As one DCRUGger said to me last night, we
> should at least assume that Scenario authors can handle a basic Excel
> spreadsheet.  That is, that the Scenario could contain the FIT table column
> headers so that the Scenarios serve as templates that are specialized by
> rows in the FIT table.  This seems more natural as the substitutions become
> far clearer just by looking at the plain text.

Please keep in mind that this is an *additional* way to do things -
you can still write your steps exactly as you do in Story Runner,
using regexps.

Cheers,
David

>
> Disclaimer: My exposure to FIT is limited to a quick read of Ward
> Cunningham's page on FIT and Cucumber.
>
> Evan
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread Evan David Light


On Sep 12, 2008, at 11:51 AM, David Chelimsky wrote:


Please keep in mind that this is an *additional* way to do things -
you can still write your steps exactly as you do in Story Runner,
using regexps.


Ah, good point.  I missed that nuance in your comment on my blog.

Perhaps the presence of the FIT table should alter Cucumber's behavior  
WRT Scenario?  This could allow the original Story Runner syntax to  
hold.  However, it would also allow, in the presence of a FIT table,  
for a Scenario to serve as a template.


WDYT? (had to consider that acronym when I first saw it today).

Evan
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 10:35 AM, Evan David Light
<[EMAIL PROTECTED]> wrote:
> Last night, I gave a presentation to the DC Ruby Users Group
> (http://dcrug.org) on Plain Text Stories with Ruby.  I spoke on both RSpec
> Plain Text Stories, which I have used, and Cucumber which I started to dig
> into a couple of nights ago.  You can see the presentation here
> (http://evan.tiggerpalace.com/2008/09/11/plain-text-stories-at-dcrug/) if
> that floats your boat.
>
> You may also note in the linked blog entry that the general consensus at
> DCRUG (and my own feeling as well) is that Cucumber's scenario syntax
> perhaps assumes undue technical ignorance on the part of the scenario
> author(s).
>
> It seems odd to me (and several DCRUGgers) that the hooks into the Scenario
> steps/substitution points are not apparent by reading the Scenario plain
> text.  That is, you have to read the Scenario step implementations to figure
> out where the hooks are in the Scenario plain text.
>
> This seems somewhat wrong-headed.  As one DCRUGger said to me last night, we
> should at least assume that Scenario authors can handle a basic Excel
> spreadsheet.  That is, that the Scenario could contain the FIT table column
> headers so that the Scenarios serve as templates that are specialized by
> rows in the FIT table.  This seems more natural as the substitutions become
> far clearer just by looking at the plain text.
>
> Disclaimer: My exposure to FIT is limited to a quick read of Ward
> Cunningham's page on FIT and Cucumber.

I commented on your blog.

Cheers,
David

>
> Evan
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 11:04 AM, Evan David Light
<[EMAIL PROTECTED]> wrote:
>
> On Sep 12, 2008, at 11:51 AM, David Chelimsky wrote:
>
>> Please keep in mind that this is an *additional* way to do things -
>> you can still write your steps exactly as you do in Story Runner,
>> using regexps.
>
> Ah, good point.  I missed that nuance in your comment on my blog.
>
> Perhaps the presence of the FIT table should alter Cucumber's behavior WRT
> Scenario?  This could allow the original Story Runner syntax to hold.
>  However, it would also allow, in the presence of a FIT table, for a
> Scenario to serve as a template.

What you're proposing might look this:

Scenario: division
  Given a numerator
  And a denominator
  Then the calculator should provide a quotient

  |numerator|denominator|quotient|

This will put some constraints on the phrasing that might be a good
thing, might not.

What if we just allowed free text in there that was not at all bound
to the table:

Examples: division
  When you divide a numerator by a denominator,
  the calculator should provide the quotient.

  |numerator|denominator|quotient|

WDYTAT?

>
> WDYT? (had to consider that acronym when I first saw it today).
>
> Evan
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread Evan David Light


On Sep 12, 2008, at 11:50 AM, David Chelimsky wrote:


I commented on your blog.



Yup, I know.  I know very well who you are, David. ;-)  I've seen you  
speak a few times and even chatted with you briefly outside RailsConf  
'08 about this crazy idea that I had to redo RSpec Plain Text Stories  
in Treetop.  Then you told me that Aslak already did it. ;-)


Evan
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


[rspec-users] booting rails routing without a controller call

2008-09-12 Thread Matt Wynne
We're getting into some quite complex routing, and I'd like to be  
able to spec the routing on its own.


All our controllers tend to have a little call to like this to boot  
up the routing before testing params_from etc:


get :index

However I can't get this to work in a spec that doesn't start with  
describe SomeController.


Does anyone know how to get the routing loaded up without actually  
calling a controller?


cheers,
Matt

http://blog.mattwynne.net
http://songkick.com

In case you wondered: The opinions expressed in this email are my own  
and do not necessarily reflect the views of any former, current or  
future employers of mine.




___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread Evan David Light


On Sep 12, 2008, at 12:14 PM, David Chelimsky wrote:


What you're proposing might look this:

Scenario: division
 Given a numerator
 And a denominator
 Then the calculator should provide a quotient

 |numerator|denominator|quotient|

This will put some constraints on the phrasing that might be a good
thing, might not.




I agree that my proposal is not necessarily the answer.



What if we just allowed free text in there that was not at all bound
to the table:

Examples: division
 When you divide a numerator by a denominator,
 the calculator should provide the quotient.

 |numerator|denominator|quotient|

WDYTAT?


	I believe that binding the table to the phrasing would be immensely  
useful and perhaps even crucial to Scenario authors.


	Also, couldn't your second example also support binding to the table  
headers?


Evan
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] booting rails routing without a controller call

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 11:17 AM, Matt Wynne <[EMAIL PROTECTED]> wrote:
> We're getting into some quite complex routing, and I'd like to be able to
> spec the routing on its own.
> All our controllers tend to have a little call to like this to boot up the
> routing before testing params_from etc:
> get :index
> However I can't get this to work in a spec that doesn't start with describe
> SomeController.
> Does anyone know how to get the routing loaded up without actually calling a
> controller?

Should work if the file lives in spec/controllers. If not, you can do this:

describe "blah routing", :type => :controller do
  ..
end


> cheers,
> Matt
> 
> http://blog.mattwynne.net
> http://songkick.com
> In case you wondered: The opinions expressed in this email are my own and do
> not necessarily reflect the views of any former, current or future employers
> of mine.
>
>
>
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 11:16 AM, Evan David Light
<[EMAIL PROTECTED]> wrote:
>
> On Sep 12, 2008, at 11:50 AM, David Chelimsky wrote:
>
>> I commented on your blog.
>
>
> Yup, I know.  I know very well who you are, David. ;-)  I've seen you speak
> a few times and even chatted with you briefly outside RailsConf '08 about
> this crazy idea that I had to redo RSpec Plain Text Stories in Treetop.
>  Then you told me that Aslak already did it. ;-)

I remember you well from RailsConf and associated Werewolf games. I
was really responding to try to keep the conversation in one place :)

Cheers,
David
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread Evan David Light


On Sep 12, 2008, at 12:19 PM, David Chelimsky wrote:


On Fri, Sep 12, 2008 at 11:16 AM, Evan David Light
<[EMAIL PROTECTED]> wrote:


On Sep 12, 2008, at 11:50 AM, David Chelimsky wrote:


I commented on your blog.



Yup, I know.  I know very well who you are, David. ;-)  I've seen  
you speak
a few times and even chatted with you briefly outside RailsConf '08  
about
this crazy idea that I had to redo RSpec Plain Text Stories in  
Treetop.

Then you told me that Aslak already did it. ;-)


I remember you well from RailsConf and associated Werewolf games


Hrm.  You witnessed one of my crappier Werewolf games.  Feel free to  
erase that memory at your convenience. ;-)




. I
was really responding to try to keep the conversation in one place :)



Roger roger.  I'd rather have it here than on my blog as well.  The  
more, the merrier.

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 11:19 AM, Evan David Light
<[EMAIL PROTECTED]> wrote:
>
> On Sep 12, 2008, at 12:14 PM, David Chelimsky wrote:
>
>> What you're proposing might look this:
>>
>> Scenario: division
>>  Given a numerator
>>  And a denominator
>>  Then the calculator should provide a quotient
>>
>>  |numerator|denominator|quotient|
>>
>> This will put some constraints on the phrasing that might be a good
>> thing, might not.
>>
>
>
>I agree that my proposal is not necessarily the answer.
>
>
>> What if we just allowed free text in there that was not at all bound
>> to the table:
>>
>> Examples: division
>>  When you divide a numerator by a denominator,
>>  the calculator should provide the quotient.
>>
>>  |numerator|denominator|quotient|
>>
>> WDYTAT?
>
>I believe that binding the table to the phrasing would be immensely
> useful and perhaps even crucial to Scenario authors.

Can you give an example of how this would be helpful?

>Also, couldn't your second example also support binding to the table
> headers?

Anything is possible :) How would you envision that working. What
would trigger binding one word in a phrase to a header?
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread Damian Jones
David Chelimsky wrote:

> To make that transition easy for you, I'd recommend either moving to
> cucumber now, or at least taking the "decoupled step definitions"
> approach within Story Runner. Check out http://pastie.org/271244 (with
> the steps, story and output) and let me know if it makes sense to you.
> 
> HTH,
> David

Thanks for that, unfortunately I am having problems installing the 
Cucumber gem

ERROR:  While executing gem ... (Errno::ENOENT)
No such file or directory - 
c:/ruby/lib/ruby/gems/1.8/gems/aslakhellesoy-cuc
umber-0.1.5/bin/cucumber

-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 11:37 AM, David Chelimsky <[EMAIL PROTECTED]> wrote:
> On Fri, Sep 12, 2008 at 11:22 AM, Damian Jones <[EMAIL PROTECTED]> wrote:
>> David Chelimsky wrote:
>>
>>> To make that transition easy for you, I'd recommend either moving to
>>> cucumber now, or at least taking the "decoupled step definitions"
>>> approach within Story Runner. Check out http://pastie.org/271244 (with
>>> the steps, story and output) and let me know if it makes sense to you.
>>>
>>> HTH,
>>> David
>>
>> Thanks for that, unfortunately I am having problems installing the
>> Cucumber gem
>>
>> ERROR:  While executing gem ... (Errno::ENOENT)
>>No such file or directory -
>> c:/ruby/lib/ruby/gems/1.8/gems/aslakhellesoy-cuc
>> umber-0.1.5/bin/cucumber
>
> You don't need the gem to use cucumber with Rails:
>
> script/plugin install git://github.com/aslakhellesoy/cucumber.git
> script/generate cucumber
> rake features
>
> If you still want the gem anyway, try doing it manually:
>
> git clone git://github.com/aslakhellesoy/cucumber.git
> cd cucumber
> rake gem
> rake install_gem

FYI - I added a cheat for that:

cheat install_cucumber_gem

(If you don't have cheat installed, then "gem install cheat")

>
> Cheers,
> David
>
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>> ___
>> rspec-users mailing list
>> rspec-users@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>>
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread Damian Jones
Phew, Thanks all for the input.  Just need an outside eye to help me 
find a stupid mistake.  I am using JEdit (on a windows box, 
unfortunately can't afford a Mac at the moment!) I had renamed 
Views/Product to Views/Products in JEdit but didn't realise it doesn't 
update the actual file system.

I switched the debugger on and found the exception saying couldn't find 
the view in the specified path, check my file system and found the 
problem.

It passes now.

Just need to try to get cucumber installed.

-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread Evan David Light

On Sep 12, 2008, at 12:26 PM, David Chelimsky wrote:

  I believe that binding the table to the phrasing would be  
immensely

useful and perhaps even crucial to Scenario authors.


Can you give an example of how this would be helpful?



I'll try.

Let's define a couple of roles for, the sake of discussion.  Features  
are written in plain text by a "business person" or "domain expert"  
who is not a programmer and that the Steps are implemented by a "code  
monkey".


I believe that code monkeys could be confused by the following:

Given a Widget
When I supply a line of text that starts with a foo
Then it should output bar

 |type of widget|text_input|result|
 |Widget2|blech|foobar|

Looking at the Scenario above, I can't tell, by reading the Given,  
When, or Then lines where "widget_2", "blech", and "foobar" will be  
used respectively.


However, if I could say:

Given a type of widget
When I supply a line of text that starts with my text input
Then it should output the desired output

|type of widget|my text input|the desired output|


I believe that the latter is a fair bit cleaner.  Again, this approach  
would use the FIT table headers as metadata that informs the use of  
the Scenario as a template for running Scenarios.


To nitpick my suggestion just a tad, I wonder whether trimming the  
matched FIT column headers is a good idea or not; however, padding the  
FIT table headers with a little white space may also make them a  
little more readable.


Evan


  Also, couldn't your second example also support binding to  
the table

headers?


Anything is possible :) How would you envision that working. What
would trigger binding one word in a phrase to a header?


___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread David Chelimsky
On Fri, Sep 12, 2008 at 11:22 AM, Damian Jones <[EMAIL PROTECTED]> wrote:
> David Chelimsky wrote:
>
>> To make that transition easy for you, I'd recommend either moving to
>> cucumber now, or at least taking the "decoupled step definitions"
>> approach within Story Runner. Check out http://pastie.org/271244 (with
>> the steps, story and output) and let me know if it makes sense to you.
>>
>> HTH,
>> David
>
> Thanks for that, unfortunately I am having problems installing the
> Cucumber gem
>
> ERROR:  While executing gem ... (Errno::ENOENT)
>No such file or directory -
> c:/ruby/lib/ruby/gems/1.8/gems/aslakhellesoy-cuc
> umber-0.1.5/bin/cucumber

You don't need the gem to use cucumber with Rails:

script/plugin install git://github.com/aslakhellesoy/cucumber.git
script/generate cucumber
rake features

If you still want the gem anyway, try doing it manually:

git clone git://github.com/aslakhellesoy/cucumber.git
cd cucumber
rake gem
rake install_gem

Cheers,
David

>
> --
> Posted via http://www.ruby-forum.com/.
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec in Rails -- HTTP methods

2008-09-12 Thread Mark Dodwell
Many thanks for the info, that certainly clarifies things!

~ Mark
-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-12 Thread Damian Jones
When ever I try to install a plugin from a git repository I just get:

removing: ../vendor/plugins/cucumber/.git

is this because I am on windows, or is there something I need to do?

-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread Joseph Wilk
Evan David Light wrote:
> On Sep 12, 2008, at 12:26 PM, David Chelimsky wrote:
> 
>>>   I believe that binding the table to the phrasing would be  
>>> immensely
>>> useful and perhaps even crucial to Scenario authors.
>>
>> Can you give an example of how this would be helpful?
>>
> 
> I'll try.
> 
> Let's define a couple of roles for, the sake of discussion.  Features
> are written in plain text by a "business person" or "domain expert"
> who is not a programmer and that the Steps are implemented by a "code
> monkey".
> 
> I believe that code monkeys could be confused by the following:
> 
> Given a Widget
> When I supply a line of text that starts with a foo
> Then it should output bar
> 
>   |type of widget|text_input|result|
>   |Widget2|blech|foobar|
> 
> Looking at the Scenario above, I can't tell, by reading the Given,
> When, or Then lines where "widget_2", "blech", and "foobar" will be
> used respectively.
> 
> However, if I could say:
> 
> Given a type of widget
> When I supply a line of text that starts with my text input
> Then it should output the desired output
> 
> |type of widget|my text input|the desired output|
> 
> 
> I believe that the latter is a fair bit cleaner.  Again, this approach
> would use the FIT table headers as metadata that informs the use of
> the Scenario as a template for running Scenarios.
> 
> To nitpick my suggestion just a tad, I wonder whether trimming the
> matched FIT column headers is a good idea or not; however, padding the
> FIT table headers with a little white space may also make them a
> little more readable.
> 
> Evan

Interesting idea. The problem I see is that the steps would have to 
bind:

> Given a type of widget
> When I supply a line of text that starts with my text input
> Then it should output the desired output

Given('a type of widget') do
  ...
end

But you would want values given by your FIT table.

Given(/a .+/) do |widget|
  ...
end

So now you have a Scenario in plain text which is never run though it 
matches the Given step, unlike any other scenario not using FIT.

So far in Cucumber the first scenario is executable, the following FIT 
values run the scenario with the different values. In terms of 
consistency and matching plain text to steps it feels like header 
matchers complicate things.

I agree there is difficulty with FIT values and bindings. I find using 
good descriptive columns names really helps and quoting bound values in 
the plain text. I find this much easier to match up:

Given a 'Widget'
When I supply a line of text that starts with a 'foo'
Then it should output 'bar'

But as you said it still leaves some instances where its confusing. I'm 
also playing with a tool I've written to allow business people to edit 
FIT values in cucumber through a web interface. I'm starting to feel 
that I'm happy writing plain text features/scenarios but FIT tables are 
the sort of thing I would really rather do through a FITness style wiki.

If quotes are a pain perhaps this is something that could be combated by 
IDEs and a clever syntax highlighting plugin (using colour maybe)?

--
Joseph Wilk
http://www.joesniff.co.uk
-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] RSpec in Rails -- HTTP methods

2008-09-12 Thread tastapod
+1 for ramaze. The gem also installs some lovely example apps and they
use rspec for their development, so there are plenty of example specs
both at the code and integration (web) level.

I've not been writing ruby web apps in anger but for all the little
example apps I write I've been using ramaze.

It is also view-agnostic (any combination of erb, haml, cass, etc) and
persistence-agnostic (sequel, og, *cough* activerecord, datamapper).

It's a breath of fresh air!

Cheers, Dan
On 12/09/2008, Ashley Moran <[EMAIL PROTECTED]> wrote:
>
> On 10 Sep 2008, at 23:21, Matt Wynne wrote:
>
>> With that one sentence, you have summed up all the painful bits of
>> my first five weeks on rails. Bring on merb :)
>
> If you're doing something simple, try Ramaze[1] (although I will
> investigate Merb in depth soon for a more significant project).  I've
> started using it to build mockup versions of web APIs I need to code
> against*, and I've been amazed how simple, elegant and flexible it
> is.  I have yet to write any specs against its controllers (although
> they do specifically enable that), but specs against models are ORM-
> dependent, and stories can be done in something implementation
> independent (I'm currently favouring Celerity[2]).
>
> Rails has grown from a snazzy little framework into an untestable
> behemoth, and I'm doing my best to avoid it.  There's a lot of
> frameworks and libraries now that give RSpec and BDD processes the
> respect they deserve, rather than forcing anyone that wants to do BDD
> to make ugly workarounds.
>
> The work the RSpec team has done to make Rails testable is fantastic
> and should be applauded.  But I can't help feel it's an unfortunate
> sink on everyone's time, a bit like maintaining Windows compatibility
> in ports of software.
>
> But that's just me grumbling as usual... I've got a very low tolerance
> for kludgy software.  What can't everything be perfect, goddammit!!!
>
> Ashley
>
> * including Twitter - let me know if anyone here would benefit from a
> simple Twitter implementation (like Laconica) that plays nice with the
> Twitter gem, and I'll see if we can open source it...
>
> [1] http://ramaze.net/
> [2] http://celerity.rubyforge.org/
>
> --
> http://www.patchspace.co.uk/
> http://aviewfromafar.net/
>
>
>
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] cucumber gem install

2008-09-12 Thread Damian Jones
David Chelimsky wrote:
> On Fri, Sep 12, 2008 at 7:46 AM, aslak hellesoy
> <[EMAIL PROTECTED]> wrote:
>>> C:\>gem install aslakhellesoy-cucumber
>> Please get it with Git and build the gem yourself in the meanwhile.
> For anyone who's not sure about how to do that:
> 
> git clone git://github.com/aslakhellesoy/cucumber.git
> cd cucumber
> rake gem
> rake install_gem
> 
> Cheers,
> David

I tried that, but not getting anywhere with installing Cucumber, I think 
I'll wait till the gem is sorted out.

Definately want to use it though.

Cheers,
Damian
-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Cucumber Scenario syntax

2008-09-12 Thread Evan David Light


On Sep 12, 2008, at 4:01 PM, Joseph Wilk wrote:


I agree there is difficulty with FIT values and bindings. I find using
good descriptive columns names really helps


Couldn't agree more there.


and quoting bound values in
the plain text. I find this much easier to match up:

Given a 'Widget'
When I supply a line of text that starts with a 'foo'
Then it should output 'bar'



This is a clever hack around a current weakness in Cucumber.  I really  
like it.  However, it would sit better with me if Cucumber enforced  
that syntax.


___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


[rspec-users] cucumber setup and teardown

2008-09-12 Thread Ben Mabey
Hi all,
I added a section to Cucumber's wiki about converting StoryListeners
into Cucumber's API.  Since I'm still learning my self I'd appreciate it
if someone could look at what I wrote and make sure I didn't miss anything.
http://github.com/aslakhellesoy/cucumber/wikis/migration-from-rspec-stories

I was also wondering if Cucumber's API has a way to do setup and
teardown on a feature level.  I would like to be able to have feature
specific setup and teardown, and be able to to do scenario setup and
teardown just for certain features as well.

>From what I can tell the only way you could accomplish this by using the
formatter/listener like is done in the story runner...
The justification for this feature is mostly from a resources
standpoint.  I have certain features/stories that use other system
resources than the rest of my features... and they require there own
unique setup and tear down.  However, currently I have to apply that
setup every where which slows that the suite.  Am I missing something?

Thanks,

Ben


___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] cucumber gem install

2008-09-12 Thread Matt Wynne

On 12 Sep 2008, at 22:37, Damian Jones wrote:


David Chelimsky wrote:

On Fri, Sep 12, 2008 at 7:46 AM, aslak hellesoy
<[EMAIL PROTECTED]> wrote:

C:\>gem install aslakhellesoy-cucumber

Please get it with Git and build the gem yourself in the meanwhile.

For anyone who's not sure about how to do that:

git clone git://github.com/aslakhellesoy/cucumber.git
cd cucumber
rake gem
rake install_gem

Cheers,
David


I tried that, but not getting anywhere with installing Cucumber, I  
think

I'll wait till the gem is sorted out.


I feel your pain: Windows does not make this stuff too easy, and most  
people playing with these tools are using *nix variants so you don't  
get much support.


I just wrote a really basic but gentle tutorial on getting git up and  
running on Windows:


http://blog.mattwynne.net/2008/09/13/bring-git-joy-to-windows/

Github's docs have a guide for Windows users:

http://github.com/guides/using-git-and-github-for-the-windows-for- 
newbies


Good luck!

cheers,
Matt

http://blog.mattwynne.net
http://songkick.com

In case you wondered: The opinions expressed in this email are my own  
and do not necessarily reflect the views of any former, current or  
future employers of mine.




___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] booting rails routing without a controller call

2008-09-12 Thread Matt Wynne

Worked perfectly, thank you.

By moving our routes config into lib/routing/default_routes.rb, I can  
also get autotest to watch the file for changes - double bonus!


On 12 Sep 2008, at 17:21, David Chelimsky wrote:

On Fri, Sep 12, 2008 at 11:17 AM, Matt Wynne <[EMAIL PROTECTED]>  
wrote:
We're getting into some quite complex routing, and I'd like to be  
able to

spec the routing on its own.
All our controllers tend to have a little call to like this to  
boot up the

routing before testing params_from etc:
get :index
However I can't get this to work in a spec that doesn't start with  
describe

SomeController.
Does anyone know how to get the routing loaded up without actually  
calling a

controller?


Should work if the file lives in spec/controllers. If not, you can  
do this:


describe "blah routing", :type => :controller do
  ..
end



cheers,
Matt

http://blog.mattwynne.net
http://songkick.com
In case you wondered: The opinions expressed in this email are my  
own and do
not necessarily reflect the views of any former, current or future  
employers

of mine.



___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


cheers,
Matt

http://blog.mattwynne.net
http://songkick.com

In case you wondered: The opinions expressed in this email are my own  
and do not necessarily reflect the views of any former, current or  
future employers of mine.




___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Growl notifications don't work each time??

2008-09-12 Thread Scott Taylor


On Sep 12, 2008, at 1:38 AM, Pat Maddox wrote:


"Greg Hauptmann" <[EMAIL PROTECTED]> writes:

Hi - has anyone had problems with Growl notifications not working  
each

time?  I can hit save on a test, wait, check.  Then hit save again,
wait, check.  Sometimes the growl notification doesn't work.

I'm using ZenTest / Rspec.
* ZenTest (3.10.0)
* Macintosh-2:myequity greg$ ruby -v
ruby 1.8.6 (2007-09-23 patchlevel 110) [i686-darwin9.3.0]
* Macintosh-2:myequity greg$ rails -v
Rails 2.1.1


I don't know about your particular problem, but since you're on OS X I
recommend using RSpactor instead.  The app itself just works better,  
and

growl notifications work great out of the box.


Have you gotten rspactor to work with only specific directories?  I'd  
like to run rspactor only in spec/unit, but can't seem to find any  
documentation on it.


Also - why does it only work on OS X.5?

Scott

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] mocking the shell command (Kernel module)

2008-09-12 Thread Scott Taylor


On Sep 12, 2008, at 9:29 AM, Matt Wynne wrote:


On 12 Sep 2008, at 14:12, Joaquin Rivera Padron wrote:

what is the best (or any) way of mocking the running of shell  
commands?


e.g.
code like the following:

def method
  %{ ls }
end

spec:

it "should list the directory contents"
  shell = mock(Object) # %{} lives in Kernel module and its sugar  
for `

  shell.should_receive(:`).with(:ls)
end

sorry about latter one, thanks in advance
joaquin


I suggest you put a 'seam' between your code and the call the Kernel.


That sounds like a good idea.  You can also Kernel#` directly (instead  
of `foo` call Kernel.send(:`, "foo").  This allows you to stub out  
Kernel#`.


Scott

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Growl notifications don't work each time??

2008-09-12 Thread Zach Dennis
On Fri, Sep 12, 2008 at 11:11 PM, Scott Taylor
<[EMAIL PROTECTED]> wrote:
>
> On Sep 12, 2008, at 1:38 AM, Pat Maddox wrote:
>
>> "Greg Hauptmann" <[EMAIL PROTECTED]> writes:
>>
>>> Hi - has anyone had problems with Growl notifications not working each
>>> time?  I can hit save on a test, wait, check.  Then hit save again,
>>> wait, check.  Sometimes the growl notification doesn't work.
>>>
>>> I'm using ZenTest / Rspec.
>>> * ZenTest (3.10.0)
>>> * Macintosh-2:myequity greg$ ruby -v
>>> ruby 1.8.6 (2007-09-23 patchlevel 110) [i686-darwin9.3.0]
>>> * Macintosh-2:myequity greg$ rails -v
>>> Rails 2.1.1
>>
>> I don't know about your particular problem, but since you're on OS X I
>> recommend using RSpactor instead.  The app itself just works better, and
>> growl notifications work great out of the box.
>
> Have you gotten rspactor to work with only specific directories?  I'd like
> to run rspactor only in spec/unit, but can't seem to find any documentation
> on it.
>
> Also - why does it only work on OS X.5?

Because it relies on the File System Events API which was introduced in 10.5.

-- 
Zach Dennis
http://www.continuousthinking.com
http://www.mutuallyhuman.com
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Growl notifications don't work each time??

2008-09-12 Thread Scott Taylor


On Sep 12, 2008, at 11:25 PM, Zach Dennis wrote:


On Fri, Sep 12, 2008 at 11:11 PM, Scott Taylor
<[EMAIL PROTECTED]> wrote:


On Sep 12, 2008, at 1:38 AM, Pat Maddox wrote:


"Greg Hauptmann" <[EMAIL PROTECTED]> writes:

Hi - has anyone had problems with Growl notifications not working  
each

time?  I can hit save on a test, wait, check.  Then hit save again,
wait, check.  Sometimes the growl notification doesn't work.

I'm using ZenTest / Rspec.
* ZenTest (3.10.0)
* Macintosh-2:myequity greg$ ruby -v
ruby 1.8.6 (2007-09-23 patchlevel 110) [i686-darwin9.3.0]
* Macintosh-2:myequity greg$ rails -v
Rails 2.1.1


I don't know about your particular problem, but since you're on OS  
X I
recommend using RSpactor instead.  The app itself just works  
better, and

growl notifications work great out of the box.


Have you gotten rspactor to work with only specific directories?   
I'd like
to run rspactor only in spec/unit, but can't seem to find any  
documentation

on it.

Also - why does it only work on OS X.5?


Because it relies on the File System Events API which was introduced  
in 10.5.


This was designed for TimeMachine, right?

Scott
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


[rspec-users] form_for url

2008-09-12 Thread Jonathan Linowes

hi,

I'm specing a view that contains

<% form_for @page, :url => { :action => :update },...

and get the error

No route matches {:action=>"update"}

In the spec, I've tried several things, including

it "should work" do
assigns[:page] = mock_model(Page)
request.env["HTTP_REFERER"] = "/pages/123/edit"
request.request_url= "/pages/123/edit"
render "pages/edit"
end

Suggestions?
thx

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users