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
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
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
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
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
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
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
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'
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
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
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
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
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
13 matches
Mail list logo