Re: [rspec-users] @current_user in controller specs

2010-12-14 Thread Elliot Winkler
You can't say User.new(:id=>27) as ActiveRecord prevents :id from being mass-assigned like that (in the case of an action that does User.new(params[:user]) in the controller, people would be able to set the id through the POST data). Try User.new.tap {|u| u.id = 27 } instead. -- Elliot On Fri, De

Re: [rspec-users] Recognising RSpec files in the Textmate bundle

2010-08-08 Thread Elliot Winkler
On Sun, Aug 8, 2010 at 3:53 PM, Phillip Koebbe wrote: > Here's another idea that's not so great, but maybe it will spur some > thinking in someone else. What about a custom generator (or a flag on the > official one) that added something like a shebang line at the beginning of > example files. A s

Re: [rspec-users] Newbie : How to spec params hash amendment

2010-08-02 Thread Elliot Winkler
On 7/30/10 5:53 AM, Martin Hawkins wrote: I have no idea how to approach 'rspec'ing the creation of the params[:user][:password] and :password_confirmation or the random_password method and would very much appreciate it if somebody could spare the time to suggest what I should be doing. You coul

Re: [rspec-users] How it would be tested?

2010-07-25 Thread Elliot Winkler
On 21 July 2010 22:41, tests learner wrote: > But How i would write if i don't know nothing about the code ? Well, you do know something about the code. You don't know what the code is exactly, but you should have a overall grasp of the different aspects of the feature you're adding and how peo

Re: [rspec-users] customize output of script/spec?

2010-05-22 Thread Elliot Winkler
I don't think RSpec has a built-in way to customize that. I think you'll just have to override the matcher you're using. Clone the git repo (or, `gem install open_gem` and then `gem open rspec`) and take a look at the spec/matchers/* directory for more (note that `.should ==`, `.should_not ==` is O

Re: [rspec-users] no should raise_exception

2009-12-19 Thread Elliot Winkler
raise_error already catches any type of exception, error or not:   class BlahException < Exception; end   class BlahError < StandardError; end lambda { raise BlahException }.should raise_error(BlahException) lambda { raise BlahError }.should raise_error(BlahError) lambda { raise "blah" }.sh

Re: [rspec-users] spec_helper getting reloaded after specs run under Textmate/Spork

2009-11-23 Thread Elliot Winkler
Great, I'm glad it's not just me :) I'll ask there. -- Elliot On 11/23/09 11:47 AM, Ben Mabey wrote: David Chelimsky wrote: On Sat, Nov 21, 2009 at 12:28 AM, Elliot Winkler mailto:elliot.wink...@gmail.com>> wrote: I'm having the hardest time trying to figur

Re: [rspec-users] spec_helper getting reloaded after specs run under Textmate/Spork

2009-11-23 Thread Elliot Winkler
nd then another computer... -- Elliot On 11/21/09 12:28 AM, Elliot Winkler wrote: I'm having the hardest time trying to figure out something weird I've suddenly run into. So I'm using Spork to run my specs. Naturally I've got TM_RSPEC_OPTS in Textmate set to --drb and I'

[rspec-users] spec_helper getting reloaded after specs run under Textmate/Spork

2009-11-20 Thread Elliot Winkler
I'm having the hardest time trying to figure out something weird I've suddenly run into. So I'm using Spork to run my specs. Naturally I've got TM_RSPEC_OPTS in Textmate set to --drb and I'm running `spork` from the command line to fire up the Spork server. However, if I have a spec file open i

Re: [rspec-users] rails /lib module testing

2009-11-16 Thread Elliot Winkler
That's because assigns only works in a Rails functional test. If you're the author of the module, you could add a self.included block that then sets up an attr_reader :link, like so: def self.included(base) base.class_eval do attr_reader :link end end Then, all you have to s

Re: [rspec-users] Model specs and ActiveRecord::TestCase

2009-10-14 Thread Elliot Winkler
Actually it seems someone read my mind... just tried out the patch in #896 and it seems to work great. So, problem solved ;) -- Elliot On 10/14/09 1:18 PM, David Chelimsky wrote: On Wed, Oct 14, 2009 at 3:01 PM, Elliot Winkler wrote: Is there any reason why the ModelExampleGroup in

[rspec-users] Model specs and ActiveRecord::TestCase

2009-10-14 Thread Elliot Winkler
Is there any reason why the ModelExampleGroup in rspec-rails inherits from ActiveSupport::TestCase and not ActiveRecord::TestCase? I noticed this because I tried to use assert_queries in one of my specs and obviously it told me it didn't know what that was. Not a huge problem, I can always add

[rspec-users] spec --drb always has a successful exit code even when specs fail

2009-09-29 Thread Elliot Winkler
Okay, so what I'm trying to do is write a rake task that runs my specs and then, if they succeed, run svn commit. (In lieu of continuous integration since I want it to happen semi-manually for now.) So basically I'm running 'rake spec' and then checking the exit status. However, I seem to have to r