Displaying 17 results from an estimated 17 matches for "failure_message".
2007 Jan 09
9
Date Approximation in Specs
The floating-point expectations allow for an error tolerance. Is
there any similar facility for dates? For example, say I have a
custom class that handles date/time spans and I want to spec it:
context "A DateRange span" do
specify "should know when a week ago is :)" do
d = DateRange.new
d.last_week.should_be_close_to(1.week.ago, 24*60*60)
end
end
The idea
2007 Sep 05
6
Caveman Questions
Hello!
I''m just a caveman with some caveman questions.
I''ve been parsing Rspec for quite a while, and I''m writing my first series
of specs. My initial impressions are "Verbose, but understandable. Helpful
and intuitive, but so much to digest." I want to congratulate the folks who
are dedicating a chunk of their lives to writing this, and ask 2 caveman
2007 Jan 05
6
RSpec 0.7.5 with Rails and rcov
I seem to be missing something because I am at a loss on how to get
rcov, RSpec, and Rails working together. Would someone mind dropping
some hints?
2007 Jun 18
7
Testing for cross site scripting, etc.
Being new to testing and ruby, are there "standard" tests that can be
done that test for things like cross site scripting and friends?
If not, anyone have ideas on what I might do about testing those sorts
of things?
I''ll be using rails, also.
Mike B.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging
2007 Oct 09
23
Testing layouts with RSpec on Rails
Hey guys,
Does anyone have any wisdom to share on the subject of speccing Rails
layouts?
Most of it''s plain old view specs stuff, but are there sensible ways
to verify things like the yield call? (Mocking doesn''t catch that)
Thanks,
Matt
--
Matt Patterson | Design & Code
<matt at reprocessed org> | http://www.reprocessed.org/
2007 Mar 29
21
a better "should have valid associations"
...rescue ActiveRecord::EagerLoadPolymorphicError
# nothing. Can''t find :include a polymorph. This requires a
better test.
rescue => err
@failed_association = "#{assoc.name} // #{err}"
end
end
!@failed_association
end
def failure_message
"invalid association \"#{@failed_association}\" on #{@model_class}"
end
end
def have_valid_associations
HaveValidAssociations.new
end
end
========================================
Put this in your model spec.
context "A new Page" do
include Act...
2009 Apr 02
8
Problem with Custom matcher and Blocks
...id = id
@block = block
end
def matches? response
response.should have_selector(''form#%s'' % [@id]) do |form|
!@block or @block.call form
end
end
def description
"have a form with id #{@id}"
end
def failure_message
"expected to have a form with ID #{@id}"
end
def negative_failure_message
"expected not to have a form with ID #{@id}"
end
end
def have_a_form_with_id id, &block
HaveAFormWithID.new id, &block
end
end
Sorry for all the...
2007 Nov 09
26
RSpec on Rails 2.0
I have a project on edge rails that I''m trying to convert from Test:Unit
to rspec. I have the rspec gem version 2338, the rspec and
rsepc_on_rails version 2831 in vendor/plugins, and rails version 8117 in
vendor/rails.
I''ve been able to get a few specs passing, have gotten the specs running
from autotest, and am able to do "rake spec:doc" and get the basic
command
2007 Feb 16
6
some fun functionality for all your specs
I''ve found these two snippets of code useful and would love some feedback.
first, .should_have_valid_associations
usage:
context "A new Product" do
specify "should have valid associations" do
@product.should_have_valid_associations
end
end
code: (thanks to Wilson/Defiler for converting to rspec)
module Spec
module Expectations
module Should
2007 Jan 27
1
should expectation syntax has changed
This is just a note in case anyone else is using the (I believe
experimental) custom expectations.
The custom expectation I had written used the custom ''met_by?''
function, which now appears to have been replaced by the ''matches?''
function to determine whether the expectation is met.
Steve
2009 Mar 15
0
rspec 1.2.0 Released
...r protocol has been improved. The old protocol is still
supported, so as long as you''re not monkey patching rspec''s built-in
matchers, or using extension libraries that do, this should not affect
you. If you run into trouble, you''ll just need to change:
* failure_message => failure_message_for_should
* negative_failure_message => failure_message_for_should_not
* All references to rubygems have been removed from within rspec''s code.
* See http://gist.github.com/54177 for rationale and suggestions on
alternative approaches to...
2011 Jul 25
6
What does using a lambda in rspec tests accomplish?
Here is the code in question:
describe UsersController do
render_views
…
…
describe "POST to ''create'' action" do
describe "failure" do
before(:each) do
@attr = { :name => '''', :email => '''', :password => '''',
:password_confirmation =>
2007 Nov 08
0
error on migration
...ec. I''m using trunk rspec with edge
rails. I get an error on migration though, here it is:
rake db:migrate RAILS_ENV="test" --trace
(in /home/pat/railsapp)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `failure_message'' for class `Spec::Matchers::Have''
/home/pat/railsapp/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4:in
`alias_method''
/home/pat/railsapp/vendor/plugins/rspec_on_rails/lib/spec/matchers/have.rb:4
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem...
2007 May 29
12
questions rspec on rails
Hi, rather than flooding this list with separate emails, I''ve been
queueing up questions using rspec with rails. (an irc channel would
be nice too :) Here ya go...
- Is there a way to test named routes?
- Could I get an example how to test an ajax request
(link_to_remote)? would that go in view? and/or in controller spec?
- Can you assert which layout template is rendered in a
2007 May 15
3
nested blocks
Hello,
Does anyone have an explanation for why the following code results in
the error that follows? I also would value any criticisms of my
approach (i.e., defining it_should_populate_collections). Thanks
-Chris
#Code
def it_should_populate_collections(condition=nil)
it "should populate any necessary collections #{condition}" do
[*@collections_to_populate].each do
2008 Mar 17
8
should have_tag outside Rails
Hi
Google has not helped me here. I''m looking for a way to use the have_tag
assert_select wrapper outside RSpec on Rails (but in a Rails project) so I
can use it to check text strings.
Has anyone managed this?
Thanks
Ashley
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
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