From patrick at collinatorstudios.com Tue Oct 2 00:00:32 2012 From: patrick at collinatorstudios.com (Patrick J. Collins) Date: Mon, 1 Oct 2012 17:00:32 -0700 (PDT) Subject: [rspec-users] confusion with rspec + jasmine Message-ID: So, people seem to talk about integrating RSpec and Jasmine together.. I am trying to do something really simple: Have a spec that verifies that dom elements are actually captured and assigned to variables. I can't find any useful information online about how to setup something like this? So in otherwords, lets say I have a rails controller action with a corresponding view... That view has something like:

I am so special

Then say I have a .js file that does: window.accessibleStuff = { special_paragraph: $('p.special'), special_link: $('p.special a') }; and then I want to have a simle spec that will do: var elements = ["special_paragraph", "special_link"]; for (var i = 0; i < elements.length; i ++) { var key = elements[i], el = window.accessibleStuff[key]; expect(el.length).toEqual(1); } ...... That seems like a simple and reasonable thing to want to have a test for, but I don't see how to set it up so that my rails controller actions will be rendered when running my jasmine specs. It seems like all the examples I see are about jasmine testing raw javascript logic, not at all about verifying that interfacing with the dom or a library's api is working. Can anyone shed some light as to how I can get this setup? Patrick J. Collins http://collinatorstudios.com From enricostn at gmail.com Tue Oct 9 12:04:37 2012 From: enricostn at gmail.com (enrico stano) Date: Tue, 9 Oct 2012 14:04:37 +0200 Subject: [rspec-users] unexpected should_receive behaviour Message-ID: Hi, surely I'm missing something... but what!? in my spec I've User.should_receive(:find).with("1").and_return(@user) and in my controller User.find(params[:id]) green light... correct... but if I change my controller using another method, for example first: User.first or even User.all I get green light too... I was expecting an error like expected: 1 time received: 0 times could anyone give me a hint to understand that behaviour? I've opened a question on StackOverflow too: http://stackoverflow.com/questions/12799617/unexpected-rspec-should-receive-behaviour many thanks, enricostn -- ? Enrico Stano ? ? twitter @enricostano ? skype ocirneonats From benjamin.lovell at gmail.com Tue Oct 9 12:49:16 2012 From: benjamin.lovell at gmail.com (Ben Lovell) Date: Tue, 9 Oct 2012 13:49:16 +0100 Subject: [rspec-users] unexpected should_receive behaviour In-Reply-To: References: Message-ID: Hi, On 9 October 2012 13:04, enrico stano wrote: > Hi, > > surely I'm missing something... but what!? > > in my spec I've > > User.should_receive(:find).with("1").and_return(@user) > > and in my controller > > User.find(params[:id]) > > green light... correct... > > but if I change my controller using another method, for example first: > > User.first > > or even > > User.all > > I get green light too... I was expecting an error like > > expected: 1 time > received: 0 times > > could anyone give me a hint to understand that behaviour? > There is something wrong with your spec or your spec's setup. Could you post a gist of the spec and the controller action? Regards, Ben > > I've opened a question on StackOverflow too: > > http://stackoverflow.com/questions/12799617/unexpected-rspec-should-receive-behaviour > > many thanks, > > enricostn > > -- > ? Enrico Stano > ? > ? twitter @enricostano > ? skype ocirneonats > _ -------------- next part -------------- An HTML attachment was scrubbed... URL: From enricostn at gmail.com Tue Oct 9 12:56:04 2012 From: enricostn at gmail.com (enrico stano) Date: Tue, 9 Oct 2012 14:56:04 +0200 Subject: [rspec-users] unexpected should_receive behaviour In-Reply-To: References: Message-ID: Hi Ben, you could find more info browsing this Gist https://gist.github.com/3848429#file_user_controller_spec.rb I've added it to my StackOverflow question too. Thank you for your time! ennrico 2012/10/9 Ben Lovell : > Hi, > > On 9 October 2012 13:04, enrico stano wrote: >> >> Hi, >> >> surely I'm missing something... but what!? >> >> in my spec I've >> >> User.should_receive(:find).with("1").and_return(@user) >> >> and in my controller >> >> User.find(params[:id]) >> >> green light... correct... >> >> but if I change my controller using another method, for example first: >> >> User.first >> >> or even >> >> User.all >> >> I get green light too... I was expecting an error like >> >> expected: 1 time >> received: 0 times >> >> could anyone give me a hint to understand that behaviour? > > > > There is something wrong with your spec or your spec's setup. Could you post > a gist of the spec and the controller action? > > Regards, > Ben > >> >> >> I've opened a question on StackOverflow too: >> >> http://stackoverflow.com/questions/12799617/unexpected-rspec-should-receive-behaviour >> >> many thanks, >> >> enricostn >> >> -- >> ? Enrico Stano >> ? >> ? twitter @enricostano >> ? skype ocirneonats >> _ > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users -- ? Enrico Stano ? ? twitter @enricostano ? skype ocirneonats From enricostn at gmail.com Tue Oct 9 13:28:26 2012 From: enricostn at gmail.com (enrico stano) Date: Tue, 9 Oct 2012 15:28:26 +0200 Subject: [rspec-users] unexpected should_receive behaviour In-Reply-To: References: Message-ID: Hi, I think we are on the right way on StackOverflow, #find is called twice: http://stackoverflow.com/questions/12799617/unexpected-rspec-should-receive-behaviour now all I need is to detect which method call the two #find. I think that the first is CanCan #authorize! and I know that the second one is called by my UserController. But I want RSpec to tell me that in order to check this behaviour right. Something like (pseudo code) User.should_receive(:find).with("1").called_by(User.authorize!) Any hint? thank you! 2012/10/9 enrico stano : > Hi Ben, > > you could find more info browsing this Gist > https://gist.github.com/3848429#file_user_controller_spec.rb > > I've added it to my StackOverflow question too. > > Thank you for your time! > > ennrico > > 2012/10/9 Ben Lovell : >> Hi, >> >> On 9 October 2012 13:04, enrico stano wrote: >>> >>> Hi, >>> >>> surely I'm missing something... but what!? >>> >>> in my spec I've >>> >>> User.should_receive(:find).with("1").and_return(@user) >>> >>> and in my controller >>> >>> User.find(params[:id]) >>> >>> green light... correct... >>> >>> but if I change my controller using another method, for example first: >>> >>> User.first >>> >>> or even >>> >>> User.all >>> >>> I get green light too... I was expecting an error like >>> >>> expected: 1 time >>> received: 0 times >>> >>> could anyone give me a hint to understand that behaviour? >> >> >> >> There is something wrong with your spec or your spec's setup. Could you post >> a gist of the spec and the controller action? >> >> Regards, >> Ben >> >>> >>> >>> I've opened a question on StackOverflow too: >>> >>> http://stackoverflow.com/questions/12799617/unexpected-rspec-should-receive-behaviour >>> >>> many thanks, >>> >>> enricostn >>> >>> -- >>> ? Enrico Stano >>> ? >>> ? twitter @enricostano >>> ? skype ocirneonats >>> _ >> >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > > -- > ? Enrico Stano > ? > ? twitter @enricostano > ? skype ocirneonats -- ? Enrico Stano ? ? twitter @enricostano ? skype ocirneonats From alindeman at gmail.com Tue Oct 9 13:30:07 2012 From: alindeman at gmail.com (Andy Lindeman) Date: Tue, 9 Oct 2012 09:30:07 -0400 Subject: [rspec-users] unexpected should_receive behaviour In-Reply-To: References: Message-ID: On Tue, Oct 9, 2012 at 8:56 AM, enrico stano wrote: > Hi Ben, > > you could find more info browsing this Gist > https://gist.github.com/3848429#file_user_controller_spec.rb > > I've added it to my StackOverflow question too. > > Thank you for your time! It's likely that cancan is calling User.find because of load_and_authorize_resource That's likely why you see it being called twice when the stub is removed. -- Andy Lindeman http://www.andylindeman.com/ From benjamin.lovell at gmail.com Tue Oct 9 13:33:56 2012 From: benjamin.lovell at gmail.com (Ben Lovell) Date: Tue, 9 Oct 2012 14:33:56 +0100 Subject: [rspec-users] unexpected should_receive behaviour In-Reply-To: References: Message-ID: On 9 October 2012 13:56, enrico stano wrote: > Hi Ben, > > you could find more info browsing this Gist > https://gist.github.com/3848429#file_user_controller_spec.rb > > I've added it to my StackOverflow question too. > > Thank you for your time! > > ennrico > > CanCan is finding your user record somewhere in the stack so the expectation you have set is being met somewhere. Regards, Ben > 2012/10/9 Ben Lovell : > > Hi, > > > > On 9 October 2012 13:04, enrico stano wrote: > >> > >> Hi, > >> > >> surely I'm missing something... but what!? > >> > >> in my spec I've > >> > >> User.should_receive(:find).with("1").and_return(@user) > >> > >> and in my controller > >> > >> User.find(params[:id]) > >> > >> green light... correct... > >> > >> but if I change my controller using another method, for example first: > >> > >> User.first > >> > >> or even > >> > >> User.all > >> > >> I get green light too... I was expecting an error like > >> > >> expected: 1 time > >> received: 0 times > >> > >> could anyone give me a hint to understand that behaviour? > > > > > > > > There is something wrong with your spec or your spec's setup. Could you > post > > a gist of the spec and the controller action? > > > > Regards, > > Ben > > > >> > >> > >> I've opened a question on StackOverflow too: > >> > >> > http://stackoverflow.com/questions/12799617/unexpected-rspec-should-receive-behaviour > >> > >> many thanks, > >> > >> enricostn > >> > >> -- > >> ? Enrico Stano > >> ? > >> ? twitter @enricostano > >> ? skype ocirneonats > >> _ > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > -- > ? Enrico Stano > ? > ? twitter @enricostano > ? skype ocirneonats > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From enricostn at gmail.com Tue Oct 9 13:46:56 2012 From: enricostn at gmail.com (enrico stano) Date: Tue, 9 Oct 2012 15:46:56 +0200 Subject: [rspec-users] unexpected should_receive behaviour In-Reply-To: References: Message-ID: yes, it's CanCan fault! ;) any chance to check something like that (pseudo code) ? User.should_receive(:find).with("1").called_by(User.authorize!) User.should_receive(:find).with("1").called_by(controller) just to check exactly what's happening thank you! 2012/10/9 Andy Lindeman : > On Tue, Oct 9, 2012 at 8:56 AM, enrico stano wrote: >> Hi Ben, >> >> you could find more info browsing this Gist >> https://gist.github.com/3848429#file_user_controller_spec.rb >> >> I've added it to my StackOverflow question too. >> >> Thank you for your time! > > It's likely that cancan is calling User.find because of > load_and_authorize_resource > > That's likely why you see it being called twice when the stub is removed. > > -- > Andy Lindeman > http://www.andylindeman.com/ > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users -- ? Enrico Stano ? ? twitter @enricostano ? skype ocirneonats From benjamin.lovell at gmail.com Tue Oct 9 14:11:24 2012 From: benjamin.lovell at gmail.com (Ben Lovell) Date: Tue, 9 Oct 2012 15:11:24 +0100 Subject: [rspec-users] unexpected should_receive behaviour In-Reply-To: References: Message-ID: On 9 October 2012 14:46, enrico stano wrote: > yes, it's CanCan fault! ;) > > any chance to check something like that (pseudo code) ? > > User.should_receive(:find).with("1").called_by(User.authorize!) > User.should_receive(:find).with("1").called_by(controller) > > just to check exactly what's happening > > thank you! > > You can set the number of times an expectation should be met or the order in which they're executed: https://www.relishapp.com/rspec/rspec-mocks/docs/message-expectations/receive-counts Regards, Ben > > 2012/10/9 Andy Lindeman : > > On Tue, Oct 9, 2012 at 8:56 AM, enrico stano > wrote: > >> Hi Ben, > >> > >> you could find more info browsing this Gist > >> https://gist.github.com/3848429#file_user_controller_spec.rb > >> > >> I've added it to my StackOverflow question too. > >> > >> Thank you for your time! > > > > It's likely that cancan is calling User.find because of > > load_and_authorize_resource > > > > That's likely why you see it being called twice when the stub is removed. > > > > -- > > Andy Lindeman > > http://www.andylindeman.com/ > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > -- > ? Enrico Stano > ? > ? twitter @enricostano > ? skype ocirneonats > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From enricostn at gmail.com Tue Oct 9 23:03:25 2012 From: enricostn at gmail.com (enrico stano) Date: Wed, 10 Oct 2012 01:03:25 +0200 Subject: [rspec-users] unexpected should_receive behaviour In-Reply-To: References: Message-ID: ok, thank you very much for your time! bye, enrico On Tuesday, October 9, 2012, Ben Lovell wrote: > > On 9 October 2012 14:46, enrico stano > > wrote: > >> yes, it's CanCan fault! ;) >> >> any chance to check something like that (pseudo code) ? >> >> User.should_receive(:find).with("1").called_by(User.authorize!) >> User.should_receive(:find).with("1").called_by(controller) >> >> just to check exactly what's happening >> >> thank you! >> >> > You can set the number of times an expectation should be met or the order > in which they're executed: > > > https://www.relishapp.com/rspec/rspec-mocks/docs/message-expectations/receive-counts > > Regards, > Ben > > >> >> 2012/10/9 Andy Lindeman > 'alindeman at gmail.com');>>: >> > On Tue, Oct 9, 2012 at 8:56 AM, enrico stano > >> wrote: >> >> Hi Ben, >> >> >> >> you could find more info browsing this Gist >> >> https://gist.github.com/3848429#file_user_controller_spec.rb >> >> >> >> I've added it to my StackOverflow question too. >> >> >> >> Thank you for your time! >> > >> > It's likely that cancan is calling User.find because of >> > load_and_authorize_resource >> > >> > That's likely why you see it being called twice when the stub is >> removed. >> > >> > -- >> > Andy Lindeman >> > http://www.andylindeman.com/ >> > _______________________________________________ >> > rspec-users mailing list >> > rspec-users at rubyforge.org > 'rspec-users at rubyforge.org');> >> > http://rubyforge.org/mailman/listinfo/rspec-users >> >> >> >> -- >> ? Enrico Stano >> ? >> ? twitter @enricostano >> ? skype ocirneonats >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org > 'rspec-users at rubyforge.org');> >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > -- ? Enrico Stano ? ? twitter @enricostano ? skype ocirneonats -------------- next part -------------- An HTML attachment was scrubbed... URL: From lbocseg at yahoo.com.br Thu Oct 18 23:58:56 2012 From: lbocseg at yahoo.com.br (Rodrigo Rosenfeld Rosas) Date: Thu, 18 Oct 2012 20:58:56 -0300 Subject: [rspec-users] Issues upgrading RSpec Message-ID: <508097C0.5040005@yahoo.com.br> My specs work fine with this in my Gemfile.lock: grep rspec Gemfile.lock rspec (2.11.0) rspec-core (~> 2.11.0) rspec-expectations (~> 2.11.0) rspec-mocks (~> 2.11.0) rspec-core (2.11.0) rspec-expectations (2.11.1) rspec-mocks (2.11.1) rspec-rails (2.11.0) rspec (~> 2.11.0) rspec-rails (~> 2.11) After "bundle update rspec", I started to have problems like this when running "bundle exec rspec": Failure/Error: Unable to find matching line from backtrace NoMethodError: undefined method `cmd_tuples' for nil:NilClass # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/adapters/postgres.rb:191:in `execute' # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/adapters/postgres.rb:532:in `log_connection_execute' # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:547:in `rollback_transaction' # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:296:in `rescue in _transaction' # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:309:in `_transaction' # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:255:in `block in transaction' # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/connecting.rb:229:in `block in synchronize' # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/connection_pool/threaded.rb:88:in `hold' # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/connecting.rb:229:in `synchronize' # /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:253:in `transaction' # /home/rodrigo/ecore/src/ruby/matterhorn/spec/spec_helper.rb:51:in `block (3 levels) in ' ... See this spec_helper extract: config.around(:each) do |example| 51: DB.transaction(savepoint: true, rollback: :always) do example.run end end Any idea of what has been changed since the releases I'm using that could be causing this? Only the first spec is failing. All others are passing. I don't have any clue why I can't upgrade RSpec... :( -------------- next part -------------- An HTML attachment was scrubbed... URL: From dchelimsky at gmail.com Fri Oct 19 00:15:30 2012 From: dchelimsky at gmail.com (David Chelimsky) Date: Thu, 18 Oct 2012 19:15:30 -0500 Subject: [rspec-users] Issues upgrading RSpec In-Reply-To: <508097C0.5040005@yahoo.com.br> References: <508097C0.5040005@yahoo.com.br> Message-ID: On Thu, Oct 18, 2012 at 6:58 PM, Rodrigo Rosenfeld Rosas wrote: > My specs work fine with this in my Gemfile.lock: > > grep rspec Gemfile.lock > rspec (2.11.0) > rspec-core (~> 2.11.0) > rspec-expectations (~> 2.11.0) > rspec-mocks (~> 2.11.0) > rspec-core (2.11.0) > rspec-expectations (2.11.1) > rspec-mocks (2.11.1) > rspec-rails (2.11.0) > rspec (~> 2.11.0) > rspec-rails (~> 2.11) > > After "bundle update rspec", I started to have problems like this when What's in your Gemfile.lock after you do the upgrade? > running "bundle exec rspec": > > Failure/Error: Unable to find matching line from backtrace > NoMethodError: > undefined method `cmd_tuples' for nil:NilClass > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/adapters/postgres.rb:191:in > `execute' > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/adapters/postgres.rb:532:in > `log_connection_execute' > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:547:in > `rollback_transaction' > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:296:in > `rescue in _transaction' > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:309:in > `_transaction' > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:255:in > `block in transaction' > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/connecting.rb:229:in > `block in synchronize' > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/connection_pool/threaded.rb:88:in > `hold' > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/connecting.rb:229:in > `synchronize' > # > /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:253:in > `transaction' > # /home/rodrigo/ecore/src/ruby/matterhorn/spec/spec_helper.rb:51:in > `block (3 levels) in ' > ... > > See this spec_helper extract: > > config.around(:each) do |example| > 51: DB.transaction(savepoint: true, rollback: :always) do > example.run > end > end > > Any idea of what has been changed since the releases I'm using that could be > causing this? > > Only the first spec is failing. All others are passing. > > I don't have any clue why I can't upgrade RSpec... :( > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users From lbocseg at yahoo.com.br Fri Oct 19 12:18:32 2012 From: lbocseg at yahoo.com.br (Rodrigo Rosenfeld Rosas) Date: Fri, 19 Oct 2012 09:18:32 -0300 Subject: [rspec-users] Issues upgrading RSpec In-Reply-To: References: <508097C0.5040005@yahoo.com.br> Message-ID: <50814518.8020804@yahoo.com.br> Em 18-10-2012 21:15, David Chelimsky escreveu: > On Thu, Oct 18, 2012 at 6:58 PM, Rodrigo Rosenfeld Rosas > wrote: >> My specs work fine with this in my Gemfile.lock: >> >> grep rspec Gemfile.lock >> rspec (2.11.0) >> rspec-core (~> 2.11.0) >> rspec-expectations (~> 2.11.0) >> rspec-mocks (~> 2.11.0) >> rspec-core (2.11.0) >> rspec-expectations (2.11.1) >> rspec-mocks (2.11.1) >> rspec-rails (2.11.0) >> rspec (~> 2.11.0) >> rspec-rails (~> 2.11) >> >> After "bundle update rspec", I started to have problems like this when > What's in your Gemfile.lock after you do the upgrade? https://gist.github.com/6d862798a665e3cc5546 Diff is: diff --git a/Gemfile.lock b/Gemfile.lock index f3d46d6..3a40e8d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -210,10 +210,10 @@ GEM rspec-core (~> 2.11.0) rspec-expectations (~> 2.11.0) rspec-mocks (~> 2.11.0) - rspec-core (2.11.0) - rspec-expectations (2.11.1) + rspec-core (2.11.1) + rspec-expectations (2.11.3) diff-lcs (~> 1.1.3) - rspec-mocks (2.11.1) + rspec-mocks (2.11.3) rspec-rails (2.11.0) actionpack (>= 3.0) activesupport (>= 3.0) > grep rspec Gemfile.lock rspec (2.11.0) rspec-core (~> 2.11.0) rspec-expectations (~> 2.11.0) rspec-mocks (~> 2.11.0) rspec-core (2.11.1) rspec-expectations (2.11.3) rspec-mocks (2.11.3) rspec-rails (2.11.0) rspec (~> 2.11.0) rspec-rails (~> 2.11) > >> running "bundle exec rspec": >> >> Failure/Error: Unable to find matching line from backtrace >> NoMethodError: >> undefined method `cmd_tuples' for nil:NilClass >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/adapters/postgres.rb:191:in >> `execute' >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/adapters/postgres.rb:532:in >> `log_connection_execute' >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:547:in >> `rollback_transaction' >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:296:in >> `rescue in _transaction' >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:309:in >> `_transaction' >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:255:in >> `block in transaction' >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/connecting.rb:229:in >> `block in synchronize' >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/connection_pool/threaded.rb:88:in >> `hold' >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/connecting.rb:229:in >> `synchronize' >> # >> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:253:in >> `transaction' >> # /home/rodrigo/ecore/src/ruby/matterhorn/spec/spec_helper.rb:51:in >> `block (3 levels) in' >> ... >> >> See this spec_helper extract: >> >> config.around(:each) do |example| >> 51: DB.transaction(savepoint: true, rollback: :always) do >> example.run >> end >> end >> >> Any idea of what has been changed since the releases I'm using that could be >> causing this? >> >> Only the first spec is failing. All others are passing. >> >> I don't have any clue why I can't upgrade RSpec... :( >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lbocseg at yahoo.com.br Fri Oct 19 12:29:54 2012 From: lbocseg at yahoo.com.br (Rodrigo Rosenfeld Rosas) Date: Fri, 19 Oct 2012 09:29:54 -0300 Subject: [rspec-users] Issues upgrading RSpec In-Reply-To: <50814518.8020804@yahoo.com.br> References: <508097C0.5040005@yahoo.com.br> <50814518.8020804@yahoo.com.br> Message-ID: <508147C2.90006@yahoo.com.br> Em 19-10-2012 09:18, Rodrigo Rosenfeld Rosas escreveu: > Em 18-10-2012 21:15, David Chelimsky escreveu: >> On Thu, Oct 18, 2012 at 6:58 PM, Rodrigo Rosenfeld Rosas >> wrote: >>> My specs work fine with this in my Gemfile.lock: >>> >>> grep rspec Gemfile.lock >>> rspec (2.11.0) >>> rspec-core (~> 2.11.0) >>> rspec-expectations (~> 2.11.0) >>> rspec-mocks (~> 2.11.0) >>> rspec-core (2.11.0) >>> rspec-expectations (2.11.1) >>> rspec-mocks (2.11.1) >>> rspec-rails (2.11.0) >>> rspec (~> 2.11.0) >>> rspec-rails (~> 2.11) >>> >>> After "bundle update rspec", I started to have problems like this when >> What's in your Gemfile.lock after you do the upgrade? > > https://gist.github.com/6d862798a665e3cc5546 > > Diff is: > > diff --git a/Gemfile.lock b/Gemfile.lock > index f3d46d6..3a40e8d 100644 > --- a/Gemfile.lock > +++ b/Gemfile.lock > @@ -210,10 +210,10 @@ GEM > rspec-core (~> 2.11.0) > rspec-expectations (~> 2.11.0) > rspec-mocks (~> 2.11.0) > - rspec-core (2.11.0) > - rspec-expectations (2.11.1) > + rspec-core (2.11.1) > + rspec-expectations (2.11.3) > diff-lcs (~> 1.1.3) > - rspec-mocks (2.11.1) > + rspec-mocks (2.11.3) > rspec-rails (2.11.0) > actionpack (>= 3.0) > activesupport (>= 3.0) > > > > grep rspec Gemfile.lock > > rspec (2.11.0) > rspec-core (~> 2.11.0) > rspec-expectations (~> 2.11.0) > rspec-mocks (~> 2.11.0) > rspec-core (2.11.1) > rspec-expectations (2.11.3) > rspec-mocks (2.11.3) > rspec-rails (2.11.0) > rspec (~> 2.11.0) > rspec-rails (~> 2.11) Also, I must say that it still works with this diff (by manually tweaking Gemfile.lock): diff --git a/Gemfile.lock b/Gemfile.lock index f3d46d6..3750aa9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -211,9 +211,9 @@ GEM rspec-expectations (~> 2.11.0) rspec-mocks (~> 2.11.0) rspec-core (2.11.0) - rspec-expectations (2.11.1) + rspec-expectations (2.11.2) diff-lcs (~> 1.1.3) - rspec-mocks (2.11.1) + rspec-mocks (2.11.3) rspec-rails (2.11.0) actionpack (>= 3.0) activesupport (>= 3.0) But if I try to either upgrade rspec-expectations to 2.11.3 or rspec-core to 2.11.1 it will break my specs. Upgrading just rspec-expectations would break the first spec. On the other side, upgrading rspec-core would break 2 specs the first time it runs. After that it won't rollback my changes and I'll have to drop and recreate my test database :( > >>> running "bundle exec rspec": >>> >>> Failure/Error: Unable to find matching line from backtrace >>> NoMethodError: >>> undefined method `cmd_tuples' for nil:NilClass >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/adapters/postgres.rb:191:in >>> `execute' >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/adapters/postgres.rb:532:in >>> `log_connection_execute' >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:547:in >>> `rollback_transaction' >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:296:in >>> `rescue in _transaction' >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:309:in >>> `_transaction' >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:255:in >>> `block in transaction' >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/connecting.rb:229:in >>> `block in synchronize' >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/connection_pool/threaded.rb:88:in >>> `hold' >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/connecting.rb:229:in >>> `synchronize' >>> # >>> /home/rodrigo/.rvm/gems/ruby-1.9.3-p286 at rails/gems/sequel-3.35.0/lib/sequel/database/query.rb:253:in >>> `transaction' >>> # /home/rodrigo/ecore/src/ruby/matterhorn/spec/spec_helper.rb:51:in >>> `block (3 levels) in' >>> ... >>> >>> See this spec_helper extract: >>> >>> config.around(:each) do |example| >>> 51: DB.transaction(savepoint: true, rollback: :always) do >>> example.run >>> end >>> end >>> >>> Any idea of what has been changed since the releases I'm using that could be >>> causing this? >>> >>> Only the first spec is failing. All others are passing. >>> >>> I don't have any clue why I can't upgrade RSpec... :( >>> >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Wed Oct 24 16:26:53 2012 From: lists at ruby-forum.com (Kevin McCaughey) Date: Wed, 24 Oct 2012 18:26:53 +0200 Subject: [rspec-users] change() vs change{} Message-ID: Hi, I am doing the rails tutorial and there is a line: expect { click_button submit }.not_to change(User, :count) When I looked up the rspec docs and book too, I found: change {} documentation (using curly brackets). Could someone tell me what the difference is, and if I use a block for the above example, what would it look like? I am very confused about why there are two versions and can't seem to get examples for the block {} version to see it's proper usage. Many thanks! Kevin McCaughey -- Posted via http://www.ruby-forum.com/. From dchelimsky at gmail.com Wed Oct 24 16:29:38 2012 From: dchelimsky at gmail.com (David Chelimsky) Date: Wed, 24 Oct 2012 12:29:38 -0400 Subject: [rspec-users] change() vs change{} In-Reply-To: References: Message-ID: On Wed, Oct 24, 2012 at 12:26 PM, Kevin McCaughey wrote: > Hi, > > I am doing the rails tutorial and there is a line: > > expect { click_button submit }.not_to change(User, :count) > > When I looked up the rspec docs and book too, I found: > > change {} documentation (using curly brackets). Not sure which docs you looked at, but both () and {} are supported, as described in rspec's rdoc: http://rubydoc.info/gems/rspec-expectations/RSpec/Matchers#change-instance_method > > Could someone tell me what the difference is, and if I use a block for > the above example, what would it look like? > > I am very confused about why there are two versions and can't seem to > get examples for the block {} version to see it's proper usage. > > Many thanks! > > Kevin McCaughey > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users