2010/4/29 Gaston Ramos <[email protected]> > El Wed, 28 de Apr de 2010, a las 01:18:00PM -0300, Porta dijo: > > On Wed, Apr 28, 2010 at 11:55 AM, Gaston Ramos <[email protected] > >wrote: > > > > > El Tue, 27 de Apr de 2010, a las 09:30:21PM -0300, Porta dijo: > > > > Buenas. > > > > Pregunta rápida: > > > > Alguien tuvo problemas con RSpec usando el metodo create de un modelo > con > > > > act_as_taggable_on? > > > > > > > > Este es el test que falla: > > > Cómo falla no tiene niguna categoría? > > > Sería útil que hagas un pastie con los modelos involucrados > > > y las salida de la falla del test > > > > > > > On 23/04/2010 18:37, Juan Pablo Taulamet wrote: > > > > > > > > El modelo involucrado es solo el que puse en el mail. > > esta es la salida del test: > > Sí pero yo te decía que peges el código para verlo por las dudas. > > Probá hacer el mismo create en la consola y mientras mirá > los logs a ver si hay algún error. > > > Probe con la consola, y el mismo codigo anda perfecto y sin errores. El problema es con RSpec. Le sigo dando vueltas.
Gracias! > > > > > > > expected: 1, got: 0 (using ==) > > > /home/porta/Dropbox/Code/rails/pantsonfire/spec/models/statement_spec.rb:24 > > > > > > 1) > > 'Statement should have only ONE category' FAILED > > expected: 1, > > got: 0 (using ==) > > > /home/porta/Dropbox/Code/rails/pantsonfire/spec/models/statement_spec.rb:24: > > /home/porta/Dropbox/Code/rails/pantsonfire/script/spec:10: > > > > Finished in 0.292648 seconds > > > > 1 example, 1 failure > > > > agregando un puts @statement.categories.inspect adentro del test solo > > imprime [] (o sea, que las categorias estan vacias) > > > > Porta. > > > > > > > > > > #statement_spec.rb > > > > describe Statement do > > > > > > > > before(:each) do > > > > @statement = Statement.create(:text => 'dummy text', > :category_list > > > => > > > > 'Some_Category') > > > > end > > > > > > > > it "should have only ONE category" do > > > > @statement.categories.length.should == 1 > > > > end > > > un detalle podés hacer: > > > > > > @statement.should have(1).categories > > > > > > > > > > > > > > end > > > > > > > > > > > > Y este es el modelo: > > > > #statement.rb > > > > class Statement < ActiveRecord::Base > > > > acts_as_taggable_on :categories > > > > end > > > > > > > > Googleando un poco, lo mas parecido a una explicación que encontré > fue > > > esto: > > > > > > > > > > > > http://developer.newsdesk.se/2009/05/07/rails-gotcha-global-methods-can-cause-activerecord-attribute-methods-to-never-be-defined/ > > > > > > > > Pero ni siquiera estoy seguro de que ese sea el problema. > > > > > > > > Alguna idea? > > > > > > > > Por las dudas, aclaro que cuando corro el codigo por script/console, > anda > > > > todo perfecto. > > > > > > > > Gracias! > > > > > > > > Porta. > > > > > > > _______________________________________________ > > > > Ruby mailing list > > > > [email protected] > > > > > http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar > > > > > > > > > -- > > > "Most of you are familiar with the virtues of a programmer. There are > > > three, of > > > course: laziness, impatience, and hubris." > > > > > > (Larry Wall) > > > > > > > > > +-------------------------------------+ > > > Gastón Ramos > > > http://gastonramos.com.ar/ > > > GNU/Linux Counter user #450312 > > > _______________________________________________ > > > Ruby mailing list > > > [email protected] > > > > http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar > > > > > > _______________________________________________ > > Ruby mailing list > > [email protected] > > http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar > > > -- > "Most of you are familiar with the virtues of a programmer. There are > three, of > course: laziness, impatience, and hubris." > > (Larry Wall) > > > +-------------------------------------+ > Gastón Ramos > http://gastonramos.com.ar/ > GNU/Linux Counter user #450312 > _______________________________________________ > Ruby mailing list > [email protected] > http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar >
_______________________________________________ Ruby mailing list [email protected] http://lista.rubyargentina.com.ar/listinfo.cgi/ruby-rubyargentina.com.ar
