[rspec-users] unsubscribe
unsubscribe ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Unsubscribing from the list ...
I'm currently subscribed to this list on two email addresses (personal and 'work') ... i would like to remove this list from my 'personal' just to reduce the amount of email ... I have tried using the unsubscribe feature on the web site as well as attempting to send an email with unsubscribe but it refuses to get me off this list. Is there a secret that I'm missing? How do I get off this crazy ride? -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] another noob question about stubs
If you used Matt's code below, then successful? is most likely referring to a method after your open_id_authentication method. When you stub! that method you're effectively telling rspec to skip over it and return what I tell you instead. You'd need to paste more of your spec and controller action that you're stubbing for anyone to be of further help. On Apr 30, 2008, at 1:00 AM, Patrick Aljord wrote: ok thanks, I still get a undefined method `successful?', successful? is a method that is used inside of the block, it's partof the open_id_authentication plugin, any way to include the plugin in the spec so that it recognizes the method? thanks in advance Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Is testing output within content_for possible?
This might be of some use: http://rubyforge.org/pipermail/rspec-users/2007-June/001954.html On Sat, Apr 19, 2008 at 9:55 PM, Ben Mabey [EMAIL PROTECTED] wrote: Chris Olsen wrote: I wanted to test that the links below were being rendered in the views. - content_for :sidebar do %ul.links %li= edit_link edit_admin_contact_url(@contact), Contact # view test it should have the correct side bar links do do_render response.should have_tag(ul.links) do with_tag(a[href=?], edit_admin_account_url(accounts(:test))) end end The above doesn't work. Just to make sure my tests weren't the issue I removed the content_for block and the tests then passed. Is there something extra that has to be done to get the content_for contents to be rendered? Thanks for the help. Hey Chris, AFAIK you can't test content_for's in the view specs. Someone may want to correct me on that. I usually test content_for stuff in my stories. If your not using stories then you could try integrating the views on certain controller specs and testing it there. Not the answer you were probably looking for, but I hope that helps. -Ben ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] rspec + github == !submodules
Great information, David. Sounds like a useful blog post! On Thu, Apr 17, 2008 at 7:49 AM, David Chelimsky [EMAIL PROTECTED] wrote: On Apr 17, 2008, at 7:11 AM, David Chelimsky wrote: On Apr 17, 2008, at 5:20 AM, Jonathan Leighton [EMAIL PROTECTED] wrote: Hi David, Is there any chance you could elaborate on the problems please, so that other projects can make an informed decision whether to use submodules or not? There is always a chance :) What I learned was that submodules are great for things like consuming plugins in your rails projects, but not so great for a development effort in multiple people are pushing and pulling to multiple repositories with dependencies and no multi-project transaction support. The parent repository depends on specific versions of the subs. As you're making changes in your local repos, the last thing you do is commit the parent with the references to the new versions of the subs. Every time you make a change to any of the subs you have to commit a change to the parent. These changes are useful as documentation if you're updating a plugin to the latest release. Not that useful if the log is polluted with these for every commit to every submodule. When you pull, you pull the parent first, and then use git-submodule to pull the correct versions of the subs. The parent is in control of the situation and it somewhat guarantees that you're getting all the right stuff. This is GREAT for consumers, but problematic for contributors. And even then, if consumers are pulling from a development branch while developers are pushing to it, then consumers might run into problems. Let's say you're doing a pull while I'm doing a push. If I push the parent first, and I push it before you do, there is a chance that when you go to pull the subs those versions of the subs might not be there yet. Conversely, if I push the subs first and you grab an old parent, you'll be pulling old subs. No problem when you're pulling, but it's going to create problems when you go to push because you're that much further down the history. Of course, these problems exist even when you're dealing with a single repository on a team that believes in frequent commits, continuous integration, etc. And just by virtue of the fact that we have several repos with dependencies means that we're going to run into conflicts now and then. It just seems that the explicit references from parent to children adds a layer of complexity to this for both consumers and developers. This all make sense? Cheers, Jon On Wed, 2008-04-16 at 22:39 -0400, David Chelimsky wrote: Hey all, We ran into some problems last night with the repos up at github. We initially thought it was a git-submodules bug. We learned that it was something else, but in the process of trying to find the source of the bug, we learned a few things about git-submodules and have decided that it creates an unfortunate set of complications and dependencies for a development effort like ours. To that end, we have simplified. No more submodules. To update, do the following: cd rspec-dev git pull rake git:update See http://github.com/dchelimsky/rspec-dev/wikis/contributingpatches for more info. Cheers, David ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Has anyone pulled from the repo recently, but not on/after 4/16?
I might be of some help ... The last time I pulled the rspec was like Saturday or Sunday. I will tar up my rspec directory and send it over when I get home in a few hours. On 4/16/08, Pat Maddox [EMAIL PROTECTED] wrote: On Wed, Apr 16, 2008 at 10:03 AM, Steven Baker [EMAIL PROTECTED] wrote: I screwed up the repo on github and a bunch of commits are missing. So I'm hoping that there are a couple people out there that have pulled fairly recently (ideally on 4/15), but not today. If so, can you please tar up your entire rspec-dev project and email it to me so I can try to fix this? Pat, please don't accept blame for this. You didn't screw up the repo: git screwed up the repo by rewriting history when it shouldn't. Blame is irrelevant here. Code and commit history is gone, and we need to get it back. We also need to figure out how to prevent this from happening again. That's all. Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] textmate = pass, autotest = failing specs ???
That'll learn ya to use Mocha over rSpec ;) On Tue, Apr 15, 2008 at 2:27 PM, Giuseppe Bertini [EMAIL PROTECTED] wrote: catch any dependencies your tests may have on each other in order to reveal brittle tests. Following Ben's hint, I took out examples from the controller spec until I isolated the culprit. Briefly, I am switching from RSpec's built in mocking framework to Mocha and fixture_scenarios when necessary. I had forgotten to modify one of the examples, which still had this construct: object.should_receive(:method).and_return(:a_mock) instead of Mocha's: object.expects(:method).returns(:a_mock) So I have empirically learned that enabling config.mock_with :mocha in /spec/spec_helper.rb and then mixing Mocha with RSpec's own mocking/stubbing messes things up in a nasty way, in the sense that failures occur all over the place with error messages that did not help me finding the bug. And again, these errors were not raised by TextMate's environment. Tricky. Thanks for the feedback! Giuseppe -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] how to stub the :current_user and any methods associated with it
Responses shown below... Sorry this isn't extremely informative ... in a bit of a rush. Hopefully it will point you in the appropriate direction. On Sun, Apr 6, 2008 at 2:17 PM, newbie [EMAIL PROTECTED] wrote: I'm new to Rspec and I'm having a bit of trouble with this controller that I'm testing. I think I'm doing it right but I guess my syntax is wrong. I'm currently using the acts_as_authenticated plug in. What I want to test out is EventController on entering the tickets_page - should show the tickets_page if the current_user has NOT entered this page today - Below is my event controller - class EventController ApplicationController before_filter :login_required def tickets_page if current_user.has_already_entered_today? flash[:notice] = 'Come back tomorrow' redirect_to :action = 'home' else flash[:notice] = 'Welcome' end end end - Below is my rspec for this controller - require File.dirname(__FILE__) + '/../spec_helper' describe EventController do before(:each) do @current_user = mock_model(User, :id = 1) controller.stub!(:current_user).and_return(@current_user) controller.stub!(:login_required).and_return(:true) end fixtures :users describe on entering the tickets page do it should show the tickets_page if the current_user has NOT entered this page today do controller.current_user.stub! (:has_already_entered_today?).and_return(:false) get :tickets_page controller.current_user.should_receive(:has_already_entered_today?).with(:false).and_return(:false) response.should render_template(:tickets_page) end end end - My errors - Mock 'User_1001' received unexpected message :has_already_entered_today? with (no args) So this is a good start ... it means that the controller action is actually being mocked out ... you just need to keep moving forward mocking/stubbing out the rest of your controller actions. it's complaining that it doesn't know what to do on your *current_user.has_already_entered_today?* method. @current_user.stub!(:has_already_entered_today?).and_return(insert true or false here) Anyone can help with any direction of what I might be doing wrong? ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [rspec-devel] Welcome Pat Maddox
Congratulations, man. On Fri, Apr 4, 2008 at 8:23 AM, David Chelimsky [EMAIL PROTECTED] wrote: Hi all, I'm pleased to announce that Pat Maddox is joining the RSpec Development Team. As you may already know, Pat has been contributing great patches and participation on the rspec-users and rspec-devel mailing lists for quite some time. He has demonstrated a deep understanding of BDD in general, and specifically as it applies to Rails, which has certainly posed some of the more interesting questions on our mailing lists. We are all excited to have Pat on board and look forward to his continued contribution. Cheers, David ___ rspec-devel mailing list [EMAIL PROTECTED] http://rubyforge.org/mailman/listinfo/rspec-devel -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] for a beginner - good rspec examples?
David Chelimsky's http://blog.davidchelimsky.net/ blog has a lot of good information as well. On Tue, Mar 11, 2008 at 9:06 AM, Chuck Remes [EMAIL PROTECTED] wrote: On Mar 11, 2008, at 8:52 AM, Daniel Kehoe wrote: I'm learning to use rspec and I want to see some good examples. Any recommendations of open source projects that demonstrate the use of rspec? So far I've found: 1) the Caboose sample app (http://sample.caboo.se/) 2) the Altered Beast forums app ( http://beast.caboo.se/forums/1/topics/4650 ) Any others come to mind? I'm especially interested in seeing examples that spec RESTful authentication. Daniel, I was in your place asking this question about a month ago. Here are the pointers that were helpful to me. [1] http://www.oreillynet.com/pub/a/ruby/2007/08/09/behavior-driven-development-using-ruby-part-1.html [2] http://svn.nightlite.org/applications/cody/trunk/ After examining the links above, I rewrote a small project that I already had working only this time I used BDD for the process. I ended up writing about 50% more code and created about 100% more methods, but the resulting program was much easier to understand and very easy to extend. I also had 100% code coverage which was a first for me. I don't know if the code I wrote would be useful to you but I would be happy to send you a tarball (under 50k) containing this project. Good luck. cr ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] rspec controller action list
It has to do with your find_city method. You spec is expecting it to be called from controller, hence: controller.should_receive(:find_city) Where is that method and why isn't it being called should be your next questions based on the code and spec you've pasted. Hope that helps, buddy. On Thu, Feb 28, 2008 at 10:27 PM, Namrata Tiwari [EMAIL PROTECTED] wrote: Thanks Mr David for your reply. This gives me a better understanding of so called train wreck. I am still facing problems with this spec. firstly - I think I need to put a colon before order(e.g. :order= live_on DESC) #list it should list all articles do articles = mock(articles) articles.should_receive(:paginate).with(:order = live_on DESC, :conditions = { :type_for = blog }) controller.should_receive(:find_city).and_return(articles) get :list end but this gives me the following error Spec::Mocks::MockExpectationError in 'ArticlesController should list all article s' Mock 'ArticlesController' expected :find_city with (any args) once, but received it 0 times spec/controllers/articles_controller_spec.rb:3: Thanks, Namrata. -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] how do i get color with autotest on XP?
A colleague of mine says he got his working, but I have yet to see it. I will ask him on Monday and report back with what I find. On Fri, Feb 29, 2008 at 9:15 PM, Spencer Roan [EMAIL PROTECTED] wrote: @Luis Lavena ok, thank you! i'll stop beating my head against it then and keep an eye out on the updates of win32console. spencer -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Autotest file
I'm using rSpec 1.1.3 and ZenTest 3.9.1 and every time I run a test I get All Tests Passed ... perhaps I should just leave it that way? :p Anyways, I've attempted to construct my own ~/.autotest file and it's extremely basic, but for some reason whenever I make one test fail (on purpose) it still kicks off the :green hook rather than the :red one ... Anybody have any ideas? # My ~/.autotest file require 'autotest/redgreen' module Autotest::Growl def self.growl(title, msg, image=, priority=0, sticky=) system growlnotify -n autotest #{sticky} --priority #{priority} --message '#{msg}' '#{title}' end Autotest::add_hook :green do |at| growl Tests Passed!, All tests passed! end Autotest::add_hook :red do |at| growl Tests Failed!, Tests have failed! end end -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Autotest file
Yup ... was just about to respond. A little more google finally turned up http://rspec.lighthouseapp.com/projects/5645/tickets/279-autotest-never-calls-the-red-hook Thanks for the quick reply, David. On Thu, Feb 28, 2008 at 3:12 PM, David Chelimsky [EMAIL PROTECTED] wrote: On Thu, Feb 28, 2008 at 2:59 PM, Bryan Ray [EMAIL PROTECTED] wrote: I'm using rSpec 1.1.3 and ZenTest 3.9.1 and every time I run a test I get All Tests Passed ... perhaps I should just leave it that way? :p Anyways, I've attempted to construct my own ~/.autotest file and it's extremely basic, but for some reason whenever I make one test fail (on purpose) it still kicks off the :green hook rather than the :red one ... This is already fixed in trunk: svn checkout http://rspec.rubyforge.org/svn/trunk or git clone git://gitorious.org/rspec/mainline.git If you're using git you have to clone the whole repo and copy over the plugins. Anybody have any ideas? # My ~/.autotest file require 'autotest/redgreen' module Autotest::Growl def self.growl(title, msg, image=, priority=0, sticky=) system growlnotify -n autotest #{sticky} --priority #{priority} --message '#{msg}' '#{title}' end Autotest::add_hook :green do |at| growl Tests Passed!, All tests passed! end Autotest::add_hook :red do |at| growl Tests Failed!, Tests have failed! end end -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] How to mock an association
I don't know exactly how you're using the code, but validates_presence_of :user_id seems redundant. If you've setup a relationship from Group to User then Active Record will be enforcing that validation for you. Just a thought ... Other than that you would probably do (without seeing any of your code): group = mock_model(Group, :to_param = 1) user = mock_model(User, :to_param = 1) group.stub!(:user).and_return(user) On Mon, Feb 11, 2008 at 8:21 AM, Edvard Majakari [EMAIL PROTECTED] wrote: On Feb 11, 2008 1:43 PM, Wes Shaddix [EMAIL PROTECTED] wrote: I've got a group model that has a user_id attribute and a validates_existence_of :user and validates_presence_of :user_id validations. What method(s) do I need to stub on the User mock to intercept those validation calls? My goal is to isolate the Group model from the User model. See http://www.ruby-forum.com/topic/138342 and http://tersesystems.com/post/9700067.jhtml Obvious 'rails mocking associations' seemed to work for me, unless I misunderstood the question. Of course, you could just stub 'valid?' for any AR object as well. -- One day, when he was naughty, Mr Bunnsy looked over the hedge into Farmer Fred's field and it was full of fresh green lettuces. Mr Bunnsy, however, was not full of lettuces. This did not seem fair. -- Terry Pratchett, Mr. Bunnsy Has An Adventure ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Bryan Ray http://www.bryanray.net Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users