Displaying 19 results from an estimated 19 matches similar to: "unexpected failures with --reverse"
2009 Mar 23
3
Spec::Rails, "model.should have(1).error_on(:attribute)" passes when?
Spec::Rails people,
I''m curious about:
- model.should have(1).error_on(:attribute)
displayed in the URL below:
http://rspec.rubyforge.org/rspec-rails/1.2.2/classes/Spec/Rails/Extensions/ActiveRecord/InstanceMethods.html
The Rspec peepcode screencast suggests that
model.should have(1).error_on(:attribute)
should pass if
model.send(:attribute)
returns nil
For me, I get an exception
2009 Mar 23
0
Spec::Rails, "model.should have(1).error_on(:attribute)" passes when?
Spec::Rails people,
I''m curious about:
- model.should have(1).error_on(:attribute)
displayed in the URL below:
http://rspec.rubyforge.org/rspec-rails/1.2.2/classes/Spec/Rails/Exten...
The Rspec peepcode screencast suggests that
model.should have(1).error_on(:attribute)
should pass if
model.send(:attribute)
returns nil
For me, I get an exception from the rspec script.
My work-around is
2007 Mar 01
2
error_on is deprecated?
The docs say
DEPRECATED. See Spec::Rails::Expectations
model.should_have(:no).errors_on(:attribute)
model.should_have(1).error_on(:attribute)
model.should_have(3).errors_on(:attribute)
However the rdoc for Spec::Rails::Expectations shows the same code.
The only difference is that it''s "model.should
have(1).error_on(:attribute) instead"
So is error_on itself deprecated, or is
2007 Aug 18
0
RSpec and acts_as_attachment
Hey guys,
I''m getting a weird error when trying to test something like the
following. It''s a model that is using acts_as_attachment but the
weird thing is the equivalent Test::Unit case passes. Does anyone
have any ideas?
Best,
Dave
# it was a Test::Unit case first
def test_should_be_invalid_without_file
UserFile.any_instance.expects(:with_image).never
2009 Mar 23
5
Rspec weird behaviour
Hi,
I recently migrated from classic rails testing to Rspec, so I am
pretty new to the framework and still learning. I am getting weird
errors on an ActiveRecord model test, here is the basic class model
definition:
class Size < ActiveRecord::Base
has_many :quantities, :dependent => :destroy
validates_presence_of :name
validates_uniqueness_of :name, :case_sensitive => false
end
2007 Dec 17
14
Change in isolation behaviour 1.08 - 1.10 ?
Hi,
I just moved from 1.08 to 1.10 and now have one example failing, which,
under 1.08, passed. Is the due to a change in behaviour?
Here''s my spec (removed some passing examples)
require File.dirname(__FILE__) + ''/../spec_helper''
describe "A user" do
before(:each) do
@user = User.new
@valid_user = User.new(
:email =>
2008 Mar 18
6
Problem with mocking a simple has_many relationship
Hi there all. Sorry if the question sounds silly but i''m rather new at
the ''mocking'' stuff... So here is my problem (code helps more than
talking):
the model:
class Item < ActiveRecord::Base
...
has_many :images, :dependent => :destroy
...
protected
def validate
errors.add(:images, "cannot be empty") if self.images.count
end
end
the
2007 Jul 26
3
Spec for validation plugin
Hi,
I''m writing a specification for a model called Location which has a
post_code attribute which should be a valid UK postcode. I''m using the
http://svn.designbyfront.com/rails/plugins/validates_as_uk_postcode/
validates_as_uk_postcode plugin to handle the validation but I''m not sure
how I should properly specify my model.
Heres the model code:
class Location <
2007 Nov 09
9
fixture_file_upload and edge rspec?
Hi all,
I had some specs that were using fixture_file_upload that were
passing just fine. Then I froze edge rails to get some 2.0
functionality, then a I upgraded to trunk rspec to deal with
uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
After a couple other of tribulations, I have now gotten down to just
a couple of not passing specs, all using the fixture_file_upload.
2010 Aug 11
6
rspec2 not working with shoulda
I am using rails edge. I am using gem "rspec-rails", "= 2.0.0.beta.
19" .
I have following code at spec/models/user_spec.rb
require ''spec_helper''
describe User do
it { should validate_presence_of(:email) }
it { should validate_presence_of(:name) }
end
Here is my gemfile
group :development, :test do
gem ''factory_girl_rails'',
2011 Feb 25
7
Rspec2 for rails 2.3.8?
Hi experts,
I picked up a copy of the rspec book and wrote some tests in spec/lib
and spec/models for my Rails 2.3.8 code.
I was using rspec 2.5.1, rspec-core 2.5.0, rspec-expectations 2.5.0 et.
al.
But I realised that the rspec-rails version I am using is meant for
Rails3.
Which version of rspec-rails should I use for Rails 2.3.8?
Best,
Radhesh
--
Posted via http://www.ruby-forum.com/.
2008 Jan 23
6
sharing specs in a subclass
Hi
I''ve spec''d a class and they pass.
Now I''d like to assure that any subclass of this class also passes
the same specs.
Any suggestions for a clever way to handle this?
I''d prefer to keep the existing specs as is (eg instead of moving
everything into shared behaviors, or doing something to all the
''describe'' lines)
thanks
linoj
2007 May 27
12
Checking for Range
how would you check for a range using rspec?
person.password.range.should == Range.new(5..40) <- this doesn''t work
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070527/4d8cb007/attachment-0001.html
2007 May 31
28
Another attempt for a succinct model validation DSL
On 5/28/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> The behaviour you''re trying to describe is that the User should
> require that passwords bear certain qualities - in this case a length
> between 5 and 40. So you need to ask yourself how the User should
> behave when this requirement is violated, and then specify that it
> behaves that way.
>
>
2008 Aug 25
21
How much test data to use in specs
I''m not sure how much test data I should be using in my specs. I''m
writing specs for the Property model in my Rails app. Its "address"
attribute is going to be validated with this regex:
/\A\d+[a-z]? [-'', a-z]{2,128}\Z/i
At the moment, my plan is to spec out the following possibilities. A
property is invalid if its address:
1) doesn''t begin with
2006 Feb 13
2
How can I put the error messages generated by the validation routines into it''s own side frame and how can a click on a error message take me right to the error?
Hello,
I''m a newbie, coming from Visual FoxPro - a database centric and object
orientated scripting language with a rich set of graphical user
interface controlls. Lerning ruby on rails means for me to lern html as
well. But now to my
problem:
The validation errors are listed at the top of the page without any
order. Depending on the size of the form and the numbers of errors
2007 Sep 20
10
Getting Started with Story Runner
I haven''t found any How To''s to use story runner and I''m not sure how to get
started.
Should I be looking for resources on how to use rbehave?
How do I generate my first Story?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070920/07a80bc7/attachment.html
2007 Nov 25
15
Possible Problem with RSpec and
Sorry to be such a pest but I am trying to learn Ruby, Rails and RSpec all
at one go and it is a bit overwhelming. I have previously completed the
depot tutorial in the Agile Web Dev with rails book and now I am trying do
do it again using RSpec.
What I would like to know now is why I am getting a rake failure error at
the end of every spec:models run. Is this the expected behaviour when a
test
2007 Jul 24
11
Mock or Stub strategy for validates_uniqueness_of
Hi,
I''m a bit stuck with mocking a unit test of a join model with regards to a
validates_uniqueness_of clause.
I have
class Book < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clip < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clipping < AR:B
belongs_to :book
belongs_to :clip
validates_uniqueness_of :clip_id,