[rspec-users] Spec'ing Inherited Resource Controllers

2009-12-23 Thread Juanma Cervera
Hello, I am trying to write the specs for controllers that use InheritedResource. Can somebody tell me if this is possible? I have read that I have to use integrated_views, but even in that case it doesn't work. I have posted a message in the InheritedResources group and Jose Valim, has answered,

[rspec-users] Singleton classes

2010-01-19 Thread Juanma Cervera
Hello I am trying to spec a singleton ruby class, And I am having a little trouble because my specs are not more isolated, as I am getting the same instace of the class for all my examples. How should I do this.? Which is the correct way of specing a singleton class? Thanks Juanma -- Posted via

Re: [rspec-users] Singleton classes

2010-01-19 Thread Juanma Cervera
2010 at 6:03 AM, Juanma Cervera > wrote: >> Hello >> I am trying to spec a singleton ruby class, >> And I am having a little trouble because my specs are not more isolated, >> as I am getting the same instace of the class for all my examples. >> >> How sh

Re: [rspec-users] How to test an app with multiple databases?

2010-07-08 Thread Juanma Cervera
Ben Mabey wrote: > Spec::Runner.configure do |c| > c.before(:each) do > ActiveRecord::Base::establish_connection :secondary_db > DatabaseCleaner.start > ActiveRecord::Base::establish_connection :primary_db > end > > c.after(:each) do > ActiveRecord::Base::establish_connection

[rspec-users] Testing equality

2010-07-08 Thread Juanma Cervera
Hello How can I test equality with two objects when they include some attribute that is BigDecimal? if I make something like this: it "should ...whatever" do obj = Factory.create(:my_object) ... MyObject.first.should == obj end. FAILS This fails because the object expected is different fr

Re: [rspec-users] Testing equality

2010-07-09 Thread Juanma Cervera
David Chelimsky wrote: > On Jul 8, 2010, at 5:04 AM, Juanma Cervera wrote: > >> end. >> >> FAILS >> >> This fails because the object expected is different from the object >> gotten, and the only difference are the BigDecimal attributes, that are >&

Re: [rspec-users] Testing equality

2010-07-09 Thread Juanma Cervera
The updated_at has class ActiveSupport::TimeWithZone v.updated_at.should == f.updated_at fails v.updated_at.to_datetime.should == f.to_datetime.updated_at fails v.updated_at.to_s.should == f.updated_at.to_s works v.updated_at.to_i.should == f.updated_at.to_i works And adding this method to the m

[rspec-users] Problems mocking controller helpers with the last version.

2008-09-29 Thread Juanma Cervera
"input#cliente_telefono[name=?]", "cliente[telefono]") end end end and throw this error: undefined local variable or method `controller' for # Why? How can I mock the current_user helper for using in my views? 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

Re: [rspec-users] Problems mocking controller helpers with the last version.

2008-09-29 Thread Juanma Cervera
del(User, :role => "whatever") and I could check the role of the user in the view with current_user.role. Was it correct or I had to do it in another way? Thanks Juanma Cervera -- Posted via http://www.ruby-forum.com/. ___ rspec-us

Re: [rspec-users] Problems mocking controller helpers with the last version.

2008-09-29 Thread Juanma Cervera
Thanks Craig, but I think I don't understand completely. "current_user" is a helper method provided by the plugin restful_authentication to access the @current_user variable as I understand. It is defined in lib/authenticated_system.rb. We use this helper to access the current logged-in user in t

[rspec-users] Using the response object in stories

2008-09-30 Thread Juanma Cervera
I have this statement in the layout of my application (using haml) - if request.env["HTTP_USER_AGENT"].include?("MSIE") = stylesheet_link_tag 'blueprint/ie.css' = stylesheet_link_tag 'confirm_ie.css' The problem is that request.env["HTTP_USER_AGENT"] is nil when I go to some page in the feature

Re: [rspec-users] Using the response object in stories

2008-09-30 Thread Juanma Cervera
Thanks Matt. I have check the rails api and see that I can pass a hash with the headers as a parameter with the post command. post "/session", {:username => 'matt', :password => 'secret'}, {:HTTP_USER_AGENT => "MSIE"} and this works for me, by now, I don't know if I will have

[rspec-users] Setting Request headers with webrat

2008-10-02 Thread Juanma Cervera
Well, Matt was right. I have not got the solution for my problems. The problem is that I can't set the headers with click_button or visits. If anyone knows how to set the request headers with these methods of webrat, this would be very helpful. Thank yus Matt Wynne wrote: > Cool. > > Be aware

Re: [rspec-users] Rails config.gem and rspec, rspec-rails

2008-10-15 Thread Juanma Cervera
Zach Dennis wrote: > In #rspec the instructions for installing rspec and rspec-rails on a > Rails project. Specifically talking about the following line from > http://github.com/dchelimsky/rspec-rails/wikis/home > > config.gem "rspec-rails", :lib => "spec" > > I think this should be updated to

[rspec-users] Gems installation

2008-10-27 Thread Juanma Cervera
Hello. I have a problem trying to use cucumber with webrat. I thought I could use the gems versions of rspec, rspec-rails, cucumber and webrat, in fact I think that I could manage to do it two weeks ago, but now that I updated the versions of the rspec, rspec-rails and cucumber, I am getting a err

Re: [rspec-users] Gems installation

2008-10-28 Thread Juanma Cervera
Thanks Mark That was the problem Mark Thomson wrote: > The webrat gem works for me. Do you have "require 'webrat'" in your > features/steps/env.rb file? > > Mark. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyf

Re: [rspec-users] [rspec-devel] The RSpec Book

2008-12-19 Thread Juanma Cervera
I've gota a question. Is the beta for the book coming soon before Christmas or do I better think in something different from Santa Claus? Oh. Please!! Juanma -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rub

[rspec-users] Routing error with webrat

2008-12-23 Thread Juanma Cervera
Hello I am starting using cucumber with an app using restful_authentication. I am having an error that is driving me mad. I am using this step Given /^que he hecho login en la aplicación$/ do user = User.create!( :login => "mi_login", :name => "mi_nombre", :email => "mi_lo...

Re: [rspec-users] Routing error with webrat

2008-12-23 Thread Juanma Cervera
l. I think this is a bug, but I don't know. Cheers and many 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

Re: [rspec-users] Routing error with webrat

2008-12-23 Thread Juanma Cervera
.html in /public folder , when I removed it, I has the same error. 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 command

2008-12-26 Thread Juanma Cervera
Hello I want to use the cucumber command to run only the feature I am working on now. But I have a structure of folders like this: features/ administracion/ alta_centros.feature modificacion_centros.feature step_definitions/ steps_for_centros.rb ... step_def

Re: [rspec-users] cucumber command

2008-12-26 Thread Juanma Cervera
Mischa Fierer wrote: > try: > > rake features FEATURE=features/administracion/alta_centros.feature It works. Thank you very much -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mail

[rspec-users] Error when mocking a method in a class

2008-12-29 Thread Juanma Cervera
I am fighting with an error using rspec-on-rails-matchers. I have a model called "Centro" based in this table create_table "centros", :force => true do |t| t.string "nombre" t.string "cif" t.string "domicilio" t.string "codigo_postal" t.string "poblacion" t.str

Re: [rspec-users] Error when mocking a method in a class

2008-12-29 Thread Juanma Cervera
Well, it seems tha the error is indeed in the stubbing of the find method in the class of the model. def validate_uniqueness_of(attribute) return simple_matcher("model to validate the uniqueness of #{attribute}") do |model| model.class.stub!(:find).and_return(true) !model.valid? && mod

Re: [rspec-users] Error when mocking a method in a class

2008-12-29 Thread Juanma Cervera
David Chelimsky wrote: > I'm not really sure why this is stubbing find, or why the stub value > is true instead of a model. Actually, I don't even see how this would > specify validating uniqueness of the attribute without very specific > setup: > > first = Centro.create(:nombre => "example") > s

Re: [rspec-users] Error when mocking a method in a class

2008-12-30 Thread Juanma Cervera
:Matchers == How should I require 'activerecord'? Or how I have to do the setup for testing/specing plugins? Any URL for that? 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] Step tables

2009-01-15 Thread Juanma Cervera
I am having some trouble using step tables. I am trying with an step similar to the sample step generarated by the cucumber generator Then /^I should see the following froobles:$/ do |froobles| froobles.raw[1..-1].each_with_index do |row, i| row.each_with_index do |cell, j| response.s

Re: [rspec-users] Step tables

2009-01-15 Thread Juanma Cervera
> ¿Where is the method raw defined? Sorry this is stupid. Forget my last question -- 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] Step tables

2009-01-15 Thread Juanma Cervera
Can somebody confirm that the have_selector method yields to the block? In all the test I have done it seems it does not work. I even have try an step like this when /whatever / do response.should have_selector("table > tr:nth-child(#{2}) > td:nth-child(#{1})") { |td| td.inner_text.should

[rspec-users] Step tables - Writing the block for a have_selector matcher

2009-01-16 Thread Juanma Cervera
g the block for the have_selector with do...end instead of {...} And it didn't work in these case. Is this a bug or is it a special feature of this construct. Juanma Cervera -- Posted via http://www.ruby-forum.com/. ___ rspec-users mail

[rspec-users] [cucumber] Features with multiple use r iterations ¿?

2009-01-21 Thread Juanma Cervera
'Yes' Then I see "Ok" And I go to "/services/1" Is this ok or I should define the features with only one single iteration? Juanma Cervera. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-us

Re: [rspec-users] [cucumber] Features with multipl e us er iterations ¿?

2009-01-21 Thread Juanma Cervera
Thank you David. All make a lot of sense. With the urls I only was trying to clarify that the scenario spans across multiple controllers, but I am making the specs as you recommend. Juanma -- Posted via http://www.ruby-forum.com/. ___ rspec-users mai

Re: [rspec-users] Testing Sub-domains with Cucumber

2009-01-28 Thread Juanma Cervera
Jonathan Linowes wrote: > On Jan 14, 2009, at 11:39 AM, Tom Hoen wrote: > >> Posted via http://www.ruby-forum.com/. >> ___ >> rspec-users mailing list >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > for example,

[rspec-users] [Cucumber] Tabular data in steps

2009-01-29 Thread Juanma Cervera
Is it possible to mix a normal parameter argument for a step, with tabular data? Something like this: Given there is a country "Spain" with the cities: |name | |Madrid| |Barcelona | |Valencia | And this step_definition Given /^there is a country "Spain" with the cities:$/ do |

[rspec-users] [Cucumber] cucumber command does not work in db transaction

2009-01-29 Thread Juanma Cervera
manually between two sequential runs of cucumber. rake features, make db:test:prepare automatically. But cucumber no. Isn't it a bug or it's correct? and I have to delete my data each time when using cucumber command. Juanma Cervera -- Posted

Re: [rspec-users] [Cucumber] Tabular data in steps

2009-01-29 Thread Juanma Cervera
Aslak The documentation in this wiki is the best I have ever seen, and it's constantly being improved. Very good job and thanks. Juanma -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge

Re: [rspec-users] [Cucumber] cucumber command does not work in db transaction

2009-01-29 Thread Juanma Cervera
of the feature. In that case I have to call manually db:test:prepare to clean up the database. But it works like expected when I move the setup to the Scenario. Juanma Cervera -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing l

Re: [rspec-users] [Cucumber] cucumber command does not work in db transaction

2009-01-29 Thread Juanma Cervera
For now I am running this command (together) rake db:test:prepare && cucumber -r features -l es features/reservas/creacion_reserva.feature Juanma -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://

[rspec-users] [ANN] At last, the book

2009-01-29 Thread Juanma Cervera
I have just gone to "Pragmatic Programmers" and spent my money in the book I have dreaming for six months. :) Maybe I'm the first :) -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/ma

[rspec-users] Fixjour and others

2009-02-06 Thread Juanma Cervera
Hello I have seen that some people in this list is using Fixjour as the replacement of fixtures. But I can't understand why it is superior or better than other approaches to the subject like Machinist o FactoryGirl. What are the problems this library resolve? Can somebody explain this a little. T

Re: [rspec-users] Fixjour and others

2009-02-06 Thread Juanma Cervera
I'm sorry for the question. I have just seen that this question is already treated in a very near thread. I didn't see it. Juanma -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/ma

Re: [rspec-users] [ANN] rspec-1.2 release candidate

2009-02-20 Thread Juanma Cervera
David, I have an error when trying to run autospec. It works when I run 'rake spec' I don know why it is still using the rspec-1.1.12 gem. /usr/lib/ruby/gems/1.8/gems/dchelimsky-rspec-1.1.99.7/lib/spec/autorun.rb:3: undefined method `autorun' for Spec::Runner:Module (NoMethodError) from /usr

[rspec-users] Changes in specs for routes in rspec 1.1.99.x

2009-03-02 Thread Juanma Cervera
Trying the next release of rspec, I have had to make changes in the existing specs for routing. I have written an script with sed that makes this automatically (two files) spec/upgrade.sed /route_for/s/id => 1/id => "1"/g /route_for.*create/s/== \(["'].*["']\)/== {:path => \1, :m

[rspec-users] [rspec]. Inexplicable error in simple specs

2009-05-03 Thread Juanma Cervera
Hello. I am having strange errors running some specs. I have just installed the nifty_scaffolds gem from Ryan Bates, and ran "script/generate nifty_authentication --rspec --haml", I have prepared the databases, and run the specs, and I have almost all the specs failing. The odd thing is that it o

Re: [rspec-users] [rspec]. Inexplicable error in simple specs

2009-05-03 Thread Juanma Cervera
Well It seems that the problem is not with the view integration but with the fixtures. I didn't know if the fixtures loaded in the spec of a controller may affect the specs of the model, but they indeed do. I thought each spec runs in its own database transaction and the data does not affect oth

[rspec-users] spec'ing validates_uniqueness_of :whatever

2008-04-02 Thread Juanma Cervera
Hello I am learning rspec and trying to especify the activerecord validations of my models. How would I make a require_uniqueness_of specification for a field. Can I make this with mocks, without touching the database? Can somebody point me to some information or plugin for this issue. Thank you

Re: [rspec-users] spec'ing validates_uniqueness_of :whatever

2008-04-03 Thread Juanma Cervera
chers/ ¿What do you think of using this plugin? 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] rspec 1.1.4

2008-04-16 Thread Juanma Cervera
Hello. I have some troubles with rails edge and decide to try rspec-1.1.4. I have installed the plugins downloading the tarballs from github, and I have this error message when I run autotest. /home/jmcervera/work/chapado2/vendor/plugins/rspec_on_rails/lib/spec/rails/version.rb:11: (RuntimeError)

Re: [rspec-users] rspec 1.1.4

2008-04-16 Thread Juanma Cervera
Thanks Pat -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] Coloured output in rspec 1.1.4

2008-05-29 Thread Juanma Cervera
Hello. I have lost the coloured output in autotest after updating to rspec v1.1.4 I was already using the edge version and was ok then, before the last update. Anyone knows something about this? Thank you. -- Posted via http://www.ruby-forum.com/. __

Re: [rspec-users] Coloured output in rspec 1.1.4

2008-05-29 Thread Juanma Cervera
David Chelimsky wrote: > On May 29, 2008, at 1:19 AM, Juanma Cervera wrote: > >> Hello. >> >> I have lost the coloured output in autotest after updating to rspec >> v1.1.4 >> I was already using the edge version and was ok then, before the last >> updat

Re: [rspec-users] Coloured output in rspec 1.1.4

2008-05-29 Thread Juanma Cervera
Excuse me Luis. These are the versions I am using. OS: Ubuntu 8.04 Edge Rails revision 888a2927b65889465ce7a1a71e87d37640a2b41b ZenTest 3.9.2 rspec 1.1.5 a021e7bdc0d65ab40ad4d441ab8844bcd9c12f0c rspec-rails e52bc93ce598f21da00cd0589cb7cebd2c1c5130 -- Posted via

Re: [rspec-users] Coloured output in rspec 1.1.4

2008-05-29 Thread Juanma Cervera
David Chelimsky wrote: > On May 29, 2008, at 6:09 AM, Luis Lavena wrote: > >> On Thu, May 29, 2008 at 5:19 AM, Juanma Cervera <[EMAIL PROTECTED] >> forum.com> wrote: >>> Hello. >>> >>> I have lost the coloured output in autotest after updating t

Re: [rspec-users] Why has the --color gone from my life?

2008-06-06 Thread Juanma Cervera
This was an error, but I thought it was corrected by D. Chelimsky. Check this topic: http://www.ruby-forum.com/topic/154595 Juanma Cervera -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http

[rspec-users] rspec book

2008-06-16 Thread Juanma Cervera
I know that David Chelimsky and Aslak Hellesøy were writing a book about rspec for the pragmatic programmers. And I hoped it would be available as a beta book. will it be? David or Aslak, I would like if you can tell us something about the book. When can we expect it to arrive? Or maybe anyone k

[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.r

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://rubyfo

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

[rspec-users] Mocking the dynamic composition of named_scopes.

2008-09-13 Thread Juanma Cervera
gainst the database and think that this time I have to test only the chaining and not the result. 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] Mocking the dynamic composition of named_scopes.

2008-09-13 Thread Juanma Cervera
I think you're right Pat. Thanks for your answer. Juanma -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] Language configuration in cucumber

2008-09-26 Thread Juanma Cervera
to modify some rakefile? 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

Re: [rspec-users] Language configuration in cucumber

2008-09-26 Thread Juanma Cervera
nk "script/cucumber.rake" must be wrong, and it must be renamed to "script/cucumber", right? And all works. aslak hellesoy wrote: > On Fri, Sep 26, 2008 at 1:19 PM, Juanma Cervera <[EMAIL PROTECTED]> > wrote: > > ruby script/cucumber --help > > There you sh