Re: [rspec-users] MockExpectationError

2008-12-05 Thread Song Lee
yes indeed, thanks -- 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] Database.truncate_all

2008-12-05 Thread Mark Wilden
On Fri, Dec 5, 2008 at 6:32 AM, Jeff Talbot <[EMAIL PROTECTED]> wrote: > There is a seemingly very useful line of code in the cucumber wiki > that I'd like to use: > > After do ># Scenario teardown >Database.truncate_all > end > That's just an example of some code you might call in an A

Re: [rspec-users] MockExpectationError

2008-12-05 Thread Mark Wilden
On Fri, Dec 5, 2008 at 9:18 PM, Song Lee <[EMAIL PROTECTED]> wrote: >Profile.stub!(:new).and_return(@profile = mock_model(Profile)) > > (rdb:1) @profile.user = 3 > Spec::Mocks::MockExpectationError Exception: Mock 'Profile_1300' > received unexpected message :user= with (3) > You're stubbing

Re: [rspec-users] 'And' step definition

2008-12-05 Thread Mark Wilden
Thanks for your replies, David and James. I figured as much, actually, since you wouldn't want to have some And steps in your definition file and some Given steps. I was led astray by "Inside a step_definitions.rb file, steps (which strictly speaking should always be called step definitions) refer

Re: [rspec-users] Where to start after writing feature

2008-12-05 Thread David Chelimsky
On Fri, Dec 5, 2008 at 8:08 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Fri, Dec 5, 2008 at 3:36 PM, Stephen Veit <[EMAIL PROTECTED]> wrote: >> I am trying to develop code from the feature on down. >> >> So I created a brand new rails app. It has no models yet. I wrote a feature: >> >> Feat

Re: [rspec-users] Where to start after writing feature

2008-12-05 Thread David Chelimsky
On Fri, Dec 5, 2008 at 3:36 PM, Stephen Veit <[EMAIL PROTECTED]> wrote: > I am trying to develop code from the feature on down. > > So I created a brand new rails app. It has no models yet. I wrote a feature: > > Feature: Add tasks > In order to track website improvements > a user > wants to

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Ashley Moran
On 5 Dec 2008, at 20:31, Daniel Lopes wrote: Ashley Moran gave me help in another post that I open by accident when entries in the group, and now spec passed... But I still would like to understand more about mocks and stubs that I asked in previous email. Yes I just noticed I re-answere

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Daniel Lopes
Thanks a lot Nick... No, i'm not using Authlogic because already have base project with restful_authentication implemented with activation, roles and etc... and when I look authlogic the project was young, I don't know now. About Martin Fowler post, I already readed... but the problem is because I

[rspec-users] Database.truncate_all

2008-12-05 Thread Jeff Talbot
There is a seemingly very useful line of code in the cucumber wiki that I'd like to use: After do # Scenario teardown Database.truncate_all end (from http://github.com/aslakhellesoy/cucumber/wikis/migration-from-rspec-stories) But when I run this I get an uninitialized constant erro

[rspec-users] MockExpectationError

2008-12-05 Thread Song Lee
no matter how I try to stub! it still showing this error I have the following in my spec Profile.stub!(:new).and_return(@profile = mock_model(Profile)) Then (rdb:1) @profile.stub!(:user) #, @name="Pr ofile_1300">>, @args_expectation=#], @match_any_args=true>, @args_to_yield=[], @method_block

Re: [rspec-users] Cucumber and autospec do not work ?

2008-12-05 Thread Ben Mabey
Kero van Gelder wrote: Hi! I'm not sure this is how cucumber should behave. Should I file one or three tickets at http://rspec.lighthouseapp.com/projects/16211-cucumber ? $ cucumber -v 0.1.12 $ mkdir fresh $ cd fresh $ cucumber cucumber.yml was not found. Please define your 'default' and oth

Re: [rspec-users] 'And' step definition

2008-12-05 Thread James Byrne
Mark Wilden wrote: > Can you have an And step in a feature? With this, I get a NoMethodError > for > 'And': > > Given /a company named (.+)/ do |name| > @company = Company.create!(:name => name) > end > > And /a user named (.+)/ do |name| > @user = create_user name > end > > I'm probably mi

Re: [rspec-users] 'And' step definition

2008-12-05 Thread David Chelimsky
On Fri, Dec 5, 2008 at 8:16 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: > Can you have an And step in a feature? With this, I get a NoMethodError for > 'And': > > Given /a company named (.+)/ do |name| > @company = Company.create!(:name => name) > end > > And /a user named (.+)/ do |name| > @use

[rspec-users] 'And' step definition

2008-12-05 Thread Mark Wilden
Can you have an And step in a feature? With this, I get a NoMethodError for 'And': Given /a company named (.+)/ do |name| @company = Company.create!(:name => name) end And /a user named (.+)/ do |name| @user = create_user name end I'm probably missing something really obvious. ///ark __

Re: [rspec-users] Cucumber and autospec do not work ?

2008-12-05 Thread Ben Mabey
Kero van Gelder wrote: Hi! I'm not sure this is how cucumber should behave. Should I file one or three tickets at http://rspec.lighthouseapp.com/projects/16211-cucumber ? Umm... add them separately. I can take at least a couple of them... -Ben $ cucumber -v 0.1.12 $ mkdir fresh $ cd fr

[rspec-users] Cucumber and autospec do not work ?

2008-12-05 Thread Kero van Gelder
Hi! I'm not sure this is how cucumber should behave. Should I file one or three tickets at http://rspec.lighthouseapp.com/projects/16211-cucumber ? $ cucumber -v 0.1.12 $ mkdir fresh $ cd fresh $ cucumber cucumber.yml was not found. Please define your 'default' and other profiles in cucumber.

Re: [rspec-users] Where to start after writing feature

2008-12-05 Thread Daniel Lopes
I think is better create the step ( it will no work ) and then run script/generate rspec_scaffold Task name:string description:text cas_link:string or if you not using rspec: script/generate scaffold Task name:string description:text cas_link:string Atenciosamente, Daniel Lopes  Area Criaçõe

[rspec-users] Where to start after writing feature

2008-12-05 Thread Stephen Veit
I am trying to develop code from the feature on down. So I created a brand new rails app. It has no models yet. I wrote a feature: Feature: Add tasks In order to track website improvements a user wants to add tasks Scenario: User adds task Given task "Display Group Rules" does not ex

Re: [rspec-users] problem to mock association proxy

2008-12-05 Thread Daniel Area Criações
Thanks Ashley, you right. Atenciosamente, Daniel Lopes  Area Criações Design, Websites e Sistemas Web Visite: http://www.areacriacoes.com.br/projects http://blog.areacriacoes.com.br/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 55 (31) 3077-4560 /

Re: [rspec-users] problem to mock association proxy

2008-12-05 Thread Ashley Moran
On 5 Dec 2008, at 20:26, Daniel Area Criações wrote: This line is only saying that @properties (assigned[:properties]) have some value ... is that? assigns[:properties].should == :user_properties I can change above to assigns[:properties].should_not be_nill and the semantic value will be t

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Daniel Lopes
Ashley Moran gave me help in another post that I open by accident when entries in the group, and now spec passed... But I still would like to understand more about mocks and stubs that I asked in previous email. Thanks again and sorry many emails. Atenciosamente, Daniel Lopes  Area Criações D

Re: [rspec-users] problem to mock association proxy

2008-12-05 Thread Daniel Area Criações
Thanks Ashley, now the tests passed... but I want understand one thing: This line is only saying that @properties (assigned[:properties]) have some value ... is that? assigns[:properties].should == :user_properties I can change above to assigns[:properties].should_not be_nill and the semantic valu

Re: [rspec-users] problem to mock association proxy

2008-12-05 Thread Ashley Moran
On 5 Dec 2008, at 13:42, Daniel Lopes wrote: NoMethodError in 'PropertiesController responding to GET index should expose all properties of given user as @properties' You have a nil object when you didn't expect it! The error occurred while evaluating nil.properties /Users/daniellopes/Trabalh

Re: [rspec-users] stepping across features

2008-12-05 Thread James Byrne
Andrew Premdas wrote: > Pretty hard for me to comment with so much stuff and so little context. > However :) My messages are quite long enough as it is I am afraid. > about a work order to produce invoices. You have to do some design and > thinking to produce good features. Challenge assumptions

[rspec-users] View tests and fragment caching issue

2008-12-05 Thread Christopher Bailey
I hope I'm just missing something obvious here, but I am using fragment caching in a partial for a view. I test this view with an RSpec view test. The particular test is using "real" data (i.e. not mocked objects, etc.). When I run the test, it complains about not knowing of a route for the frag

Re: [rspec-users] NameError when passing a URL helper to a method

2008-12-05 Thread Nick Hoffman
On 2008-12-04, at 19:56, Pat Maddox wrote: Nick Hoffman <[EMAIL PROTECTED]> writes: On 2008-12-04, at 17:43, Nick Hoffman wrote: The only solution that I can think of is to do this: before :each do @account_url = account_url end it_should_redirect_to 'the account page', @account_url Actuall

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Nick Hoffman
On 2008-12-05, at 10:06, Daniel Lopes wrote: Thanks for help and sorry for insistance but I don't understand aspects on rspec ( I think not understand how we use mocks and stubs): Hi Daniel. If you're a bit unsure about when to use mocks vs stubs, have a read of this article by Martin Fowler

Re: [rspec-users] Rails project as a template for other projects (off topic)

2008-12-05 Thread Nick Hoffman
On 2008-12-05, at 01:51, Andrew Premdas wrote: Scott Working on this, assuming I have a cloned project 'foo' from my base project base and I'm working on foo. So I implement something new and then think this should be in base any ideas how to manage this. Was thinking maybe of having a bas

Re: [rspec-users] stepping across features

2008-12-05 Thread Andrew Premdas
Pretty hard for me to comment with so much stuff and so little context. However :) Your telling an epic story involving work orders, charges (unbilled released and billed), invoices and transactions. So what are all these things and what is the business value of them, can we right more focused and

Re: [rspec-users] stepping across features

2008-12-05 Thread James Byrne
Andrew Premdas wrote: > James, ... > > So back to your original question where does all the detail go? Well > acceptance tests start from the general and go to the specific, so > detail comes further down some sort of heirarchy. Thing is you > haven't got a hierarchy yet so you don't know where t

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Daniel Lopes
Thanks for help and sorry for insistance but I don't understand aspects on rspec ( I think not understand how we use mocks and stubs): The behavior of my controller is... Before Filter: check_administrator_role load_user So, in this case I want run my before filter methods in before block on rspec

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread David Chelimsky
On Fri, Dec 5, 2008 at 8:07 AM, Daniel Lopes <[EMAIL PROTECTED]> wrote: > Thanks Newman, I already try this but get strange error: > before do > @current_user = mock_model(User, :id => 1) > controller.stub!(:check_administrator_role).and_return(true) > User.stub(:find).with(1).and_ret

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Joseph Wilk
Daniel Lopes wrote: Thanks Newman, I already try this but get strange error: before do @current_user = mock_model(User, :id => 1) controller.stub!(:check_administrator_role).and_return(true) User.stub(:find).with(1).and_return(@user) # <=<=<=<=<=<= Looks like a missing '!': User

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Daniel Lopes
Thanks Newman, I already try this but get strange error: before do @current_user = mock_model(User, :id => 1) controller.stub!(:check_administrator_role).and_return(true) User.stub(:find).with(1).and_return(@user) # <=<=<=<=<=<= end The error: undefined method `stub' for # Atenci

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread David Chelimsky
On Fri, Dec 5, 2008 at 7:58 AM, Newman Huang <[EMAIL PROTECTED]> wrote: > > try: > > [EMAIL PROTECTED] = User.find(params[:user_id]) > User.stub(:find).with(xx).and_return(@user) Please quote enough of the email to which you are responding to provide enough context so that those of us who read ema

Re: [rspec-users] proxy associantion on controllers

2008-12-05 Thread Newman Huang
try: [EMAIL PROTECTED] = User.find(params[:user_id]) User.stub(:find).with(xx).and_return(@user) -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] problem to mock association proxy

2008-12-05 Thread Daniel Lopes
Hello, I'm trying learn Rspec but having problems to understand when and how user mocks and stubs. I have a properties_controller with to before_filter actions (check_administrator_role e load_user)... to access index action of properties_controller I need have a params[:user] and this parameter wi

[rspec-users] proxy associantion on controllers

2008-12-05 Thread Daniel Area Criações
Hello, I'm trying learn Rspec but having problems to understand when and how user mocks and stubs. I have a properties_controller with to before_filter actions (check_administrator_role e load_user)... to access index action of properties_controller I need have a params[:user] and this parameter wi

Re: [rspec-users] calling multiline steps from other steps

2008-12-05 Thread Andrew Premdas
Ooh interesting stuff thanks for that Ben, never got past the scenario tables until now :) Andrew 2008/12/5 Ben Mabey <[EMAIL PROTECTED]> > Andrew Premdas wrote: > >> Given /^I have filled in the form$/ do |details| >> details.hashes.each |pair| >> >> Can't see this working because you've got n

Re: [rspec-users] cucumber and autotest - running all features?

2008-12-05 Thread Matt Wynne
On 5 Dec 2008, at 07:21, Aslak Hellesøy wrote: On Thu, Dec 4, 2008 at 6:17 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: WDYT? Possible? Possibly. :) That does sound like it might be possible. On the other hand, in practice, I've found that the current implementation works the way I'd