Displaying 9 results from an estimated 9 matches for "should_include".
2007 May 10
2
Problem with translator
...@collection = []
end
def add_new(item)
@collection << item
end
end
specify "should include string with ''?''" do
school = OldSchool.new
school.add_item ''like ?''
school.collection.should_include ''like ?''
end
end
The resulting translation is:
it "should include string with ''?''" do
school = OldSchool.new
school.add_item ''like ?''
school.collection.should include(''like)?''
end
It wo...
2007 Feb 13
3
"should.be_in [values]" and "each_should_satisfy"
Hi!
I just started using RSpec and have some question that I couldn''t find
answers to.
If I have a result that can have two valid values, is there a better way
of writing
the following assertion?
[value1,value2].should_include actual
Is there a more elegant way of performing should_satisfy on a
collection, for
example I currently use something like collection.each {|x|
x.should_satisfy {|x| ... } }
which is very ugly. Is there something like each_should_satisfy?
Thanks,
Esad
2006 Nov 07
3
include Helper in context?
...If you have it working, I''ll go back and bang my head against it some
more, otherwise I''ll file a bug!
Many thanks,
Jerry
context "account/login (view)" do
include StandardHelpers
specify ''displays title "Login"'' do
self.methods.should_include ''title''
render ''account/login''
response.should_have_tag ''h1'', :content => ''Login''
end
end
# fails with:
ActionView::TemplateError in ''account/login (view) displays title "Login"''
undefin...
2007 Oct 04
7
Using Predicates to look at an array..
...the
tongue very well. I then looked up the use of Predicates, which I
had been using, but hadn''t realized:
shipping_type.should be_include(Cart::SHIPPING_TYPE_REGULAR)
This works, however the syntac of be_include looks very odd... Is
there any way to do:
shipping_type.should_include(Cart::SHIPPING_TYPE_REGULAR)
How are other folks looking at the contents of an Array? Am I going
around bassackwards on this?
Eric
-----------------------------------------------------
Eric Pugh | Principal | OpenSource Connections, LLC | 434.466.1467 |
http://www.opensourceconnections.com
2006 Nov 23
2
Some tips for testing respond_to block and making controller tests work with simply_helpful
Hi,
Here''s two blog posts for those that need to test respond_to blocks
and/or are currently using simply_helpful extensively.
http://blog.methodmissing.com/2006/11/22/testing-different-content-
types-with-rspec
http://blog.methodmissing.com/2006/11/23/using-simply_helpful-with-
rspec-controller-tests
- Lourens
2006 Aug 16
0
Testing has_many, :through relationships
..._many :books, :through => :readings
end
class Reading < ActiveRecord::Base
belongs_to :book
belongs_to :reader
end
My spec is simply:
context "Ben" do
fixtures :readers, :books, :readings
specify "should have read HHGTTG" do
ben = readers(:Ben)
ben.books.should_include books(:HHGTTG)
end
end
And the spec fails with:
TypeError in ''Ben should have read HHGTTG''
wrong argument type Book (expected Module)
A quick test in the console reveals that:
ben.books.include? Book.find(:first)
returns true, which I''m assuming is the logical expr...
2007 May 09
4
UI testing framework? (w/o selenium)
...test ''/'' do
page.status.should_be "200"
page.should_have :image, "logo.gif"
page.should_have :string, "Copyright 2006-Present SomeCo, Inc. All
rights reserved."
page.should_have :div, :id => ''copyright''
page.should_include :css, ''default.css''
page.should_have.no_broken_links
page.should_have.at_least.3 :div, :class => "bbxBody"
page.should_have.at_most.6 :div, :class => "someClassName"
# page.[name_of_form]_form.
page.search_form.submit :name => &qu...
2007 Feb 04
10
Spec''ing ActionMailer
Good morning (Pacific Time). I have a controller action that, as a
side-effect, sends an email to an administrator. I want it to do
something like this:
specify "when someone successfully signs up, an email should be sent
to the administrator with the person''s contact page" do
post :signup, {...lots o'' params}
response should_be success
#
2007 Jul 26
5
Coding standards and whitespace
..._redirect.tmSnippet
RSpec.tmbundle/Snippets/should_equal.tmSnippet
RSpec.tmbundle/Snippets/should_have.tmSnippet
RSpec.tmbundle/Snippets/should_have_at_least.tmSnippet
RSpec.tmbundle/Snippets/should_have_at_most.tmSnippet
RSpec.tmbundle/Snippets/should_have_records.tmSnippet
RSpec.tmbundle/Snippets/should_include.tmSnippet
RSpec.tmbundle/Snippets/should_match.tmSnippet
RSpec.tmbundle/Snippets/should_not ==.tmSnippet
RSpec.tmbundle/Snippets/should_not =~.tmSnippet
RSpec.tmbundle/Snippets/should_not eql.tmSnippet
RSpec.tmbundle/Snippets/should_not_be.tmSnippet
RSpec.tmbundle/Snippets/should_not_be_a_kind_of.t...