Displaying 15 results from an estimated 15 matches for "with_tag".
2007 May 21
9
Ordering in view specs using have_tag and with_tag
When writing view specs is there any way to test not only for the
presence of tags (have_tag) and nested tags (with_tag), but also test
that they appear in a given order?
For example, consider the following:
it ''should display the login names, display names and email
address in alternating rows'' do
response.should have_tag(''div.odd>div'') do
with_tag('...
2007 Nov 20
3
How to test views with Nested Resources and Partials
..._return("1")
assigns[:line_item] = @line_item
end
it "should render edit form" do
render "line_items/edit.haml"
response.should
have_tag("form[action=#{contract_line_item_path(@contract.id, at line_item.id)}][method=post]") do
with_tag(''input#line_item_support_type[name=?]'',
"line_item[support_type]")
with_tag(''input#line_item_product_num[name=?]'',
"line_item[product_num]")
with_tag(''input#line_item_serial_num[name=?]'',
"line_item[serial_nu...
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 Oct 01
1
have_tag and line numbers
When I''ve got a view example like this:
1: response.should have_tag "fieldset#children" do
2: with_tag "child"
3: end
If it can''t find ''child'', the error seems to come back as my_spec.rb:1
instead of my_spec.rb:2.
Has anyone else experienced this? I just spent a while tracking down what I
assumed was a problem in my have_tag only to discover it was a problem w...
2007 Oct 05
4
have_xml_tag
Hi
Was just using have_tag on an xml response and found the problem
outlined and resolved here
http://weblog.jamisbuck.org/2007/1/4/assert_xml_select
Just wondered if there is any support in rspec?
Cheers
Shane
Shane Mingins
ELC Technologies (TM)
PO Box 247
Santa Barbara, CA 93102
Phone: +64 4 568 6684
Mobile: +64 21 435 586
Email: smingins at elctech.com
AIM: ShaneMingins
Skype:
2008 Apr 19
4
Is testing output within content_for possible?
...ere being rendered in the views.
- content_for :sidebar do
%ul.links
%li= edit_link edit_admin_contact_url(@contact), "Contact"
# view test
it "should have the correct side bar links" do
do_render
response.should have_tag("ul.links") do
with_tag("a[href=?]", edit_admin_account_url(accounts(:test)))
end
end
The above doesn''t work. Just to make sure my tests weren''t the issue I
removed the content_for block and the tests then passed.
Is there something extra that has to be done to get the content_for...
2007 Nov 10
2
Problem with view spec - works inside the browser but spec fails with nil object
Hi,
I''ve been trying to find an answer for this problem in the last couple
hours, but I think no discussion was about this exact same thing. So here it
goes, hope someone can help.
I''m trying to spec a view which works correctly on the browser, but that
generates the following error when I run "rake spec:views".
ActionView::TemplateError in ''/survey/show
2007 Mar 09
6
AssertSelect for strings?
...ke to test.
Like this:
module SomeHelper
def some_helper_method
"<p>foo</p>"
end
end
context "The SomeHelper"
helper_name :some
specify do
some_helper_method.should have_tag("p", "foo")
end
end
Til
ps: the new have_tag / with_tag stuff for testing views and rspec
0.8.2 in general rocks, thanks to all involved!
2008 Jan 16
2
rspec_on_rails_matchers
...ning rake db:migrate, rake db:test:prepare, and rake spec will
give me all green. I then added the rspec_on_rails_matchers to my view
spec.. so I had this:
http://pastie.caboo.se/139655
I then removed one of my fields from my actual form to break the specs.
The original spec with have_tag and with_tag did break but the
rspec_on_rails_matcher version did not break! In fact I can do the
following and not even get it to break:
it "should render new form" do
render "/animals/new.html.erb"
response.should have_form_posting_to(animals_path) do
with_text_field_fo...
2007 Dec 29
0
should send_email always succeeds?
I wrote the following in my spec:
emails = ActionMailer::Base.deliveries
emails.length.should eql(2)
response.should send_email {
with_tag(''tr'', @contact_info[:full_name])
}
knowing that 1) an email is being sent; and 2) the contact info is in
a ''p'' tag and only in a ''p'' tag. The length expectation is met --
there are two emails. The send_email expectation is met, but sho...
2008 May 08
7
Rspec Stories / Selenium Nightmare
I have been using Rspec stories with Webrat feeling very productive and
happy.
Then I needed to do something with Selenium (Webrat could have done what
I needed but it does not yet have the functionality).
Selenium-core as part of a rails plugin looked nice but did not seem to
fit with rspec stories. So I went the Selenium-rc route.
Since Selenium uses a separate instance of rails
2008 Mar 13
22
Specifing methods in a steps_for block
Hey list,
I''m refactoring some much-used functionality into a common_steps step
group. Methods like this are in there:
steps_for :common do
Given "a number of existing $types?" do |type|
@initial_item_count = type.singularize.classify.constantize.count
end
When "the user adds an invalid $type" do |type|
post
2008 Jan 21
5
attachment_fu and story runner, any updates
I''m trying to write a story for a Rails app which involves using the
attachment_fu plugin to upload images.
After blunting my pick on this for a while, google found me this:
http://www.ruby-forum.com/topic/134743#600831
So it seems that there''s a hole in Rails integration testing and
multipart form posting. David offered to incorporate a patch to story
runner at the end of the
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 Aug 24
26
testing behaviour or testing code?
hypothetical question for all you BDD experts:
I want to make sure that a :list action always returns widgets in
alphabetical order. There''s at least 2 ways of doing this:
it "should fetch items in alphabetical order" do
Widget.should_receive(:find).with(:order => "name ASC")
get :list
end
it "should fetch items in alphabetical order" do
[:red,