[rspec-users] Why use DatabaseCleaner with rSpec?

2011-02-08 Thread Marcelo de Moraes Serpa
Hi list, I've used DatabaseCleaner in the past, but only when using Cucumber and Selenium (or Steak + Celerity) since turning on transactional_fixtures would prevent the data being accessible from app-server that is also triggered for the tests. This works fine, and is a de-facto solution for this

Re: [rspec-users] Testing only for a redirect

2010-06-25 Thread Marcelo de Moraes Serpa
I meant rspec1.x :) On Fri, Jun 25, 2010 at 6:15 PM, Marcelo de Moraes Serpa < celose...@gmail.com> wrote: > I'm still on the Rails 2 era.. so, it worked like a charm with > response.should be_redirect. > > Thanks, > > Marcelo. > > On Fri, Jun 25, 201

Re: [rspec-users] Testing only for a redirect

2010-06-25 Thread Marcelo de Moraes Serpa
I'm still on the Rails 2 era.. so, it worked like a charm with response.should be_redirect. Thanks, Marcelo. On Fri, Jun 25, 2010 at 4:33 PM, David Chelimsky wrote: > > On Jun 25, 2010, at 4:00 PM, Marcelo de Moraes Serpa wrote: > > On Fri, Jun 25, 2010 at 2:18 PM, Davi

Re: [rspec-users] Testing only for a redirect

2010-06-25 Thread Marcelo de Moraes Serpa
Thanks David! :) Marcelo. On Fri, Jun 25, 2010 at 2:18 PM, David Chelimsky wrote: > On Fri, Jun 25, 2010 at 1:56 PM, Marcelo de Moraes Serpa > wrote: > > Hello guys, > > > > Quick question: How could I just test if a redirect was made, without URL > > what

[rspec-users] Testing only for a redirect

2010-06-25 Thread Marcelo de Moraes Serpa
Hello guys, Quick question: How could I just test if a redirect was made, without URL whatsoever? Thanks, Marcelo. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Bundler, rake spec and Steak

2010-06-22 Thread Marcelo de Moraes Serpa
Thanks Wincent, I'll do that. On Tue, Jun 22, 2010 at 2:37 AM, Wincent Colaiuta wrote: > El 22/06/2010, a las 08:16, Marcelo de Moraes Serpa escribió: > > > Hello list, > > > > I have noted a few problems when using rake spec. First, it doesn't seem >

[rspec-users] Bundler, rake spec and Steak

2010-06-22 Thread Marcelo de Moraes Serpa
Hello list, I have noted a few problems when using rake spec. First, it doesn't seem to load the gems from the Gemfile (:test group) I had to add a required for each gem in this group on the spec_helper.rb file when I tried to run the tests vai rake spec, if I use the spec command, it works as exp

Re: [rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-18 Thread Marcelo de Moraes Serpa
or #1. Or am I missing something? Thanks! Marcelo. On Fri, Jun 18, 2010 at 1:18 PM, David Chelimsky wrote: > On Jun 18, 2010, at 12:02 PM, Marcelo de Moraes Serpa wrote: > > One thing that just came to my mind is to fake the requests on the app > server instance. One simple way to do

Re: [rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-18 Thread Marcelo de Moraes Serpa
the spec that needs it. Any other ideas? Marcelo. On Fri, Jun 18, 2010 at 11:46 AM, Marcelo de Moraes Serpa < celose...@gmail.com> wrote: > Hello all, > > I have an acceptance test that aims to bdd a Google Apps OpenID > authentication feature. This login screen also uses so

[rspec-users] Mocking/Faking requests for js/ajax-based tests

2010-06-18 Thread Marcelo de Moraes Serpa
Hello all, I have an acceptance test that aims to bdd a Google Apps OpenID authentication feature. This login screen also uses some JS (in order to switch between the regular / Google OpenID forms). Now, I know this is not something that would prevent me from using the :rack driver for Capybara, b

Re: [rspec-users] rspec (steak) turning off transactional fixtures

2010-06-16 Thread Marcelo de Moraes Serpa
Ah, got it! Thanks for your patience, David ;) Cheers, Marcelo. On Wed, Jun 16, 2010 at 2:05 PM, David Chelimsky wrote: > > On Jun 16, 2010, at 2:02 PM, Marcelo de Moraes Serpa wrote: > > Yes, > > That's what I want to do, but my code is a little bit d

Re: [rspec-users] rspec (steak) turning off transactional fixtures

2010-06-16 Thread Marcelo de Moraes Serpa
Oh, the code in the before/after blocks is wrapped in a if options[:js]. Forgot to write it. On Wed, Jun 16, 2010 at 2:02 PM, Marcelo de Moraes Serpa < celose...@gmail.com> wrote: > Yes, > > That's what I want to do, but my code is a little bit diff

Re: [rspec-users] rspec (steak) turning off transactional fixtures

2010-06-16 Thread Marcelo de Moraes Serpa
e an object from the ruby instance running the specs, and put a breakpoint, I can't see the data outside of it :( Any ideas? Marcelo. On Wed, Jun 16, 2010 at 1:47 PM, David Chelimsky wrote: > On Jun 16, 2010, at 1:37 PM, Marcelo de Moraes Serpa wrote: > > Hi David, > > Yeah, I&

Re: [rspec-users] rspec (steak) turning off transactional fixtures

2010-06-16 Thread Marcelo de Moraes Serpa
e_transactional_fixtures = true > end > end > > end > Check the lines "config.use_transactional_fixtures" on both callbacks. I doesn't seem to disable them. Any ideas? Marcelo. On Tue, Jun 15, 2010 at 5:32 PM, David Chelimsky wrote: > On Jun 15, 2010, at 5:

Re: [rspec-users] Testing render :update

2010-06-15 Thread Marcelo de Moraes Serpa
Ah! Thanks for the heads up about heads out ;) Obrigado, Marcelo. On Tue, Jun 15, 2010 at 5:34 PM, David Chelimsky wrote: > Por nada! > > ps - em inglês, a frase é "heads up" :) > > On Jun 15, 2010, at 5:27 PM, Marcelo de Moraes Serpa wrote: > > Thanks for the

Re: [rspec-users] Testing render :update

2010-06-15 Thread Marcelo de Moraes Serpa
Thanks for the heads out, David :) On Mon, Jun 14, 2010 at 9:35 PM, David Chelimsky wrote: > > On Jun 14, 2010, at 7:05 PM, David Chelimsky wrote: > > > On Jun 14, 2010, at 6:40 PM, Marcelo de Moraes Serpa wrote: > > > >> Hey guys. > >> > >

[rspec-users] rspec (steak) turning off transactional fixtures

2010-06-15 Thread Marcelo de Moraes Serpa
Hey all, I have replaced Cucumber with Steak and I like the experience so far. It is not as polished as Cucumber in what comes to configuration, but it is simpler and covers my needs perfectly. I've followed the trick to pass a hash to the example in order to setup Capybara to use a different driv

Re: [rspec-users] Undefined method respont_to - rspec

2010-06-14 Thread Marcelo de Moraes Serpa
hat class. > > * example_group, context, and describe all mean the same thing. > > * example, specify, and it all mean the same thing > > HTH, > David > > On Jun 14, 2010, at 3:38 PM, Marcelo de Moraes Serpa wrote: > > Ah! I thought I could use it / describe / context interchangeably

[rspec-users] Testing render :update

2010-06-14 Thread Marcelo de Moraes Serpa
Hey guys. I would like to test the following behavior: render :update do |page| page.replace_html 'errors', :partial => 'signup_errors', :locals => { :errors => 'errors'} end } I'm doing: controller.should_receive(:render).with(:update) But I am not sure on

Re: [rspec-users] Undefined method respont_to - rspec

2010-06-14 Thread Marcelo de Moraes Serpa
Ah! I thought I could use it / describe / context interchangeably. Thanks, Marcelo. On Mon, Jun 14, 2010 at 3:04 PM, Trey Bean wrote: > It looks like you need to put those lines in an it block. > > it 'should...' do > token... > end > > Trey > > On Jun 14

[rspec-users] Undefined method respont_to - rspec

2010-06-14 Thread Marcelo de Moraes Serpa
Hello list, I have this very simple model spec: require 'spec_helper' describe Token do describe "Associations" do token = Token.new token.should respond_to(:user) end end When I run it, I get the following error: /spec/models/token_spec.rb:7: undefined method `respond_to' for Spec

Re: [rspec-users] How to test the assignment of current_user

2010-06-08 Thread Marcelo de Moraes Serpa
gt;> invoking #current_user=. When you do call self, which refers to the object >> itself, it will use normal method lookup, that will find your >> #current_user=. >> >> On Mon, Jun 7, 2010 at 6:43 PM, Marcelo de Moraes Serpa < >> celose...@gmail.com> wrote: &

[rspec-users] How to test the assignment of current_user

2010-06-07 Thread Marcelo de Moraes Serpa
Hello, This could be rephrased as -- How to test calls of special assigment (setter) methods? I am trying to test the assigmnet of a user object to the current_user=(new_user) method. It is part of an authentication process and finally the object is assigned to the session through this method. I

Re: [rspec-users] Controller tests fail to parse route based on resource

2010-04-25 Thread Marcelo de Moraes Serpa
ntroller#update on (snip) *No action responded to /users/89*. Actions: (snip) Thanks, Marcelo. On Sun, Apr 25, 2010 at 6:01 PM, Phillip Koebbe wrote: > On 2010-04-25 5:52 PM, Marcelo de Moraes Serpa wrote: > >> Hello list, >> >> I have a controller example that look

[rspec-users] Controller tests fail to parse route based on resource

2010-04-25 Thread Marcelo de Moraes Serpa
Hello list, I have a controller example that looks like this: it 'Should update (PUT /users/:id)' do @attributes = @user.attributes @attributes[:firstname] = "Another one" lambda { put user_url(@user),@attributes User.find(@user.id).firstname == @attributes[:

[rspec-users] Stub a class and instances

2010-04-04 Thread Marcelo de Moraes Serpa
For example, I have this scenario where a Directory model will only save if it can connect to the LDAP server. In a test I'm writting, though, connecting to the LDAP server is not relevant, so I tried doing this: context "LDAP is on" do before(:each) do Directory.stub!(:authent

[rspec-users] Recall a example inside another (just like in Cucumber)

2010-02-18 Thread Marcelo de Moraes Serpa
Hello guys, I was spec'ing a model and just tried to do something like this it "should create a payment with period_start & period_end set correctly" do it "should create a new payment for an approved transaction" previous_payment = Payment.find(Payment.last.id-1) jus

Re: [rspec-users] How to spec accessing a constant

2010-02-18 Thread Marcelo de Moraes Serpa
Why don't you open the class, and set the constant like so: class TheClass CONSTANT = 'value_it_should_have_for_the_current_spec' end This worked for me. Marcelo. On Thu, Oct 16, 2008 at 7:24 PM, Nick Hoffman wrote: > On 2008-10-16, at 15:12, Craig Demyanovich wrote: > >> Cool. Having seen

Re: [rspec-users] Stub a call that happens inside a block

2009-11-15 Thread Marcelo de Moraes Serpa
Yes, thanks, David! On Sun, Nov 15, 2009 at 10:13 PM, David Chelimsky wrote: > On Sun, Nov 15, 2009 at 7:50 PM, Marcelo de Moraes Serpa < > celose...@gmail.com> wrote: > >> Hello list, >> >> I had a hard time to find out a way to mock the singleton feed method of

Re: [rspec-users] Stub a call that happens inside a block

2009-11-15 Thread Marcelo de Moraes Serpa
Yeah, thanks David :) On Sun, Nov 15, 2009 at 10:13 PM, David Chelimsky wrote: > On Sun, Nov 15, 2009 at 7:50 PM, Marcelo de Moraes Serpa < > celose...@gmail.com> wrote: > >> Hello list, >> >> I had a hard time to find out a way to mock the singleton feed

[rspec-users] Stub a call that happens inside a block

2009-11-15 Thread Marcelo de Moraes Serpa
Hello list, I had a hard time to find out a way to mock the singleton feed method of the following class: class RssReader def self.feed(feed_url) output = [] open(feed_url) do |http| response = http.read result = RSS::Parser.parse(response, false) result.items.each_wit

[rspec-users] Webrat + Selenium and mocks/stubs with the mainline lib

2009-09-08 Thread Marcelo de Moraes Serpa
Hello list, One of my Cucumber features rely havily in Selenium (used through WebRat) and since I'm accessing external data-sources (a web-service) I decided the best way would be to mock this specific component and provide a fixture out of it. The mocking/stubbing is easy, I'm already familiar wi

[rspec-users] Using "with(params)" with stubs make any sense?

2009-08-28 Thread Marcelo de Moraes Serpa
Hello list, Since stubs don't set expectations, do we have any use-case where stubbing like this makes sense: @mock.stub!(:method).with(anything()).and_return(@collection). It is clear that and_return is the value from stubbing, but the with doesn't make any sense, in case, IMO. Thanks, Marcel

Re: [rspec-users] Sharing code and still keeping a "only commit if all is green" discipline

2009-08-21 Thread Marcelo de Moraes Serpa
ude patches or even just copy and paste. Or maybe we should just use branches, but won't be easy to convince the management to do this now. Does that make sense? Thanks again, Marcelo. On Thu, Aug 20, 2009 at 9:28 PM, Stephen Eley wrote: > On Thu, Aug 20, 2009 at 8:00 PM, Marcelo de Moraes

[rspec-users] Sharing code and still keeping a "only commit if all is green" discipline

2009-08-20 Thread Marcelo de Moraes Serpa
Hello list, I'm working in a big project in the company I'm working on as a "BDD tech lead", this means I'm leading the implementation of BDD in ongoing projects, most of them did not use BDD from the start. I implemented the policy of "Only commit if all your tests are passing", this in all test

Re: [rspec-users] Loading webrat when installed as a plugin

2009-08-04 Thread Marcelo de Moraes Serpa
s the whole idea of installing them as plugins. However, script/cucumber is still trying to find system-wide gems. Any ideas? Thanks, Marcelo. On Tue, Aug 4, 2009 at 8:13 AM, David Chelimsky wrote: > On Mon, Aug 3, 2009 at 4:00 PM, Marcelo de Moraes > Serpa wrote: >> Hello list, >&g

[rspec-users] Loading webrat when installed as a plugin

2009-08-03 Thread Marcelo de Moraes Serpa
Hello list, When installing Webrat as a plugin, do I need to change the "require 'webrat'" to point to the absolute directory in which webrat is installed in the vendor/plugins folder or is there any implicit logic in the require that I am missing? I didn't find anything in the rSpec book about th

[rspec-users] Telling rspec that a method might be called with a OR b ... ?

2009-07-28 Thread Marcelo de Moraes Serpa
Hey list, Let's say I have a model, and I want to setup a partial mock in it, to set the expectation that it should receive a message with specific arguments. I know that this is not a good design for a spec, and that I would probably need to separate this in another example -- but let's say that

Re: [rspec-users] How should you make sure the user is not authenticated

2009-07-28 Thread Marcelo de Moraes Serpa
ue, Jul 28, 2009 at 3:38 AM, Matt Wynne wrote: > > On 27 Jul 2009, at 17:39, Marcelo de Moraes Serpa wrote: > >> Hey list! >> >> Let's say I have a user story for authentication/login. >> >> I have seen many cucumber scenarios like this: >&g

[rspec-users] How should you make sure the user is not authenticated

2009-07-27 Thread Marcelo de Moraes Serpa
Hey list! Let's say I have a user story for authentication/login. I have seen many cucumber scenarios like this: Scenario: User logs in succesfully Given I am not authenticated When I go to the login page ... >From what I have seen, the Given steps that check that the user is not authenticated

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-24 Thread Marcelo de Moraes Serpa
leMethods#stub Thanks, Marcelo. On Fri, Jul 24, 2009 at 11:51 AM, Marcelo de Moraes Serpa wrote: > Thanks David and Ben for the comprehensive replies! I really appreciate it :) > > These wikipedia articles helped me to understand on the more conceptual level: > > http://en.wikipe

Re: [rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-24 Thread Marcelo de Moraes Serpa
best way to use them. My 0.4 cents of Brazilian Reals. @David -- yes, I'm Brazilian! You've got a good gut! And I'm glad to see that you know Portuguese! :) Marcelo. On Thu, Jul 23, 2009 at 8:47 PM, David Chelimsky wrote: > On Jul 23, 7:41 pm, Ben Mabey wrote: >>

[rspec-users] On Mocks vs Stubs in the context of rSpec

2009-07-23 Thread Marcelo de Moraes Serpa
Hello list, >From what I could see, the lines between mocks and stubs are subtle, but the general idea I got is that mocks set expectations and stubs are only dummy objects/method calls. What confused me though, is that the stub() method is an alias for mock() in Spec::Mocks::ExampleMethods. So a

[rspec-users] Making sure a action exists (aka specing a controller action)

2009-07-22 Thread Marcelo de Moraes Serpa
Hello list! In my efforts of following BDD in a disciplined manner, I found myself needing to spec a Rails action. The behavior I wanted to test was: "This controller should handle the index action", and since it is not good practice to go to the implementation before specing, I decided to spec t

Re: [rspec-users] Cucumber step or model spec?

2009-07-21 Thread Marcelo de Moraes Serpa
Thank you all for the replies! >I use Cucumber for specifying application behaviour and RSpec for >specifying lower level component behaviour. In the scenario you >describe: >* the application's job is to show only the active products >* the view's job is to display any products it is given by the

[rspec-users] Cucumber step or model spec?

2009-07-20 Thread Marcelo de Moraes Serpa
Hello list, I have an example/spec that relates to the Product#index view and says "it should display only the active products". The thing is the logic to filter the active products should be in the model, and not on the view, since the view should be "dumb". I just realized that, and what I thin

Re: [rspec-users] Extending the autotest discover rules

2008-11-18 Thread Marcelo de Moraes Serpa
Thanks David, I added a .autotest file in my project root path and the new mapping. It worked like a charm! Marcelo. On Wed, Nov 19, 2008 at 1:34 AM, David Chelimsky <[EMAIL PROTECTED]>wrote: > On Tue, Nov 18, 2008 at 9:18 PM, Marcelo de Moraes Serpa > <[EMAIL PROTECTED]>

[rspec-users] Extending the autotest discover rules

2008-11-18 Thread Marcelo de Moraes Serpa
Hello, We are creating tests for presenters (presenter pattern) classes. We are putting the implementation classes in app/presenters and we thought on putting the specs in spec/presenters. Question is, how could I extend the autotest discover rules so that it will also monitor the presenter classe