search for: assert_tag

Displaying 20 results from an estimated 23 matches for "assert_tag".

2006 May 04
6
second assert_tag failling in rails integration test
...(''one'') end def two render_text(''two'') end end 3) create an integration test: require "#{File.dirname(__FILE__)}/../test_helper" class MyTest < ActionController::IntegrationTest def test_one post(''/test/one'') assert_tag(:content => /one/) post(''/test/two'') assert_match(/two/, @response.body) assert_tag(:content => /two/) end end 4) ran the integration test. So, I expected the assertions to all pass, but instead I got the following error: Loaded suite test/integration/test...
2005 Nov 23
2
functional tests, assert_tag and tables
I''ve run into another functional testing issue. Odds are I''m taking the wrong approach, so I''m back to this list again in the hopes of finding the true path. with assert_tag, I''d like to check the values of various table cells and ensure that the proper values are placed in the appropriate places. I written some tests that make good sense to me, and in general they behave as expected. I ran into trouble with nested tables. To demonstrate, I''ve put...
2006 Feb 18
1
Should assert_tag be used to test rxml views?
I''m getting strange errors attempting to test an rxml view with assert_tag. I can see that what the view is producing is correct but I get an error like "ignoring attempt to close foo with bar" (where bar is a tag which is meant to be nested in foo). Is asssert_tag meant for xml, or just html? Cheers, Robert. -- Posted via http://www.ruby-forum.com/.
2006 Aug 14
0
anyone else having trouble with assert_tag :content ?
Hi everyone, In an integration test I have assert_tag :content => /Quantity/ and this always fails, even though Quantity does exist in the html. Similarly, I have assert_no_tag :content => /Quantity/ , and this fails even when Quantity *doesn''t* exist in the html. Am I missing something here? Thanks Daniel
2006 Jul 07
2
Testing views with Hpricot
assert_tag smells bad. Hpricot smells nice (apricotty!). Testing your views with Hpricot: http://www.lukeredpath.co.uk/index.php/2006/07/07/testing-your-rails- views-with-hpricot/ Big thanks to _why for a great little library! Feedback is appreciated. rSpec integration coming soon (hopefully!). Cheers, L...
2007 Jan 24
7
Differences between assert_tag and assert_select
...ones_head' %> # Generated code: <a href="#" onclick="new Ajax.Request('http://test.host/admin/parties/phone/new', {asynchronous:true, evalScripts:true, parameters:Form.serialize('phones_head')}); return false;">Add new</a> # Succeeds: assert_tag :a, :attributes => {:onclick => Regexp.new(Regexp.escape(new_phone_url))}, :content => /add new/i # Fails assert_select "a[onclick=?]", Regexp.new(Regexp.escape(new_phone_url)), /add new/i test_link_to_add_address_exists(NewPartyViewTest) [/home/francois/src/config/../vendo...
2007 Jan 11
0
writing tests for rescue_action_in_public
...me this is what I want, because I want to continue processing the error, not stop): group_controller_test.rb ------------------------ # class GroupController; def rescue_action(e) raise e end; end def test_error_no_such_group post :home, :id => "this_is_not_a_valid_id" assert_tag :content => "oops" end When I run this test, the test.log shows the expected "ActiveRecord::RecordNotFound (Couldn''t find Group with ID=this_is_not_a_valid_id)" but the test passes successfully. If I uncomment the rescue_action(e) line at the top of the...
2006 Aug 07
1
Testing & xml
Probably dead obvious, but are there any assertions for easing testing of xml output, both for builder templates (for RSS feed -- something like a version of assert_tag) and for the new restful stuff. Couldn''t find anything relevant in the API. Cheers Chris
2006 May 16
3
Testing How To Question
I''m using the functional test for a method like this: def test_create post :create, :phase => ''copynew'', :id => 1 assert_response :success assert_template ''create'' assert_tag :content => ''New Item'' assert_not_nil @item end This posts a request to the create method in the controller. Is there any way to look at the variables and objects that were created in the controller by this post? It looks like you are only able to examine the resu...
2005 Oct 10
1
ActionPack tests are failing
...ut not on Linux. The problem is, that the document.rb from EdgeRails is required (I verified that) but document itself requires "html/node" and that seems to require an old version of node which is included in glue. In this older version "childless?" takes no argument: test_assert_tag_and_url_for(ActionPackAssertionsControllerTest): ArgumentError: wrong number of arguments (1 for 0) ./test/controller/../../lib/action_controller/vendor/html-scanner/html/document.rb:41:in `childless?'' ./test/controller/../../lib/action_controller/vendor/html-scanner/html/document.rb:41...
2006 Jun 15
5
[Fwd: Functional test problem]
...through through a list of users in a fixtures file, and test against each one, but it''s doing something very weird. Here''s the basics of the test def test_index_user User.find(:all).each do |user| get :index, {}, {:user => user.id} assert_response :success assert_tag :tag => "div", :attributes => { :id => "usermenu" }, :content => /Hello\s#{user.login}/ end end What''s happening is that it''s failing, saying: expected tag, but no tag found matchin...
2006 Dec 04
5
ruby on rails ecommerce tests are failing, but why?
i am working through the Beginning Ruby on Rails Ecommerce book and on page 101 where it is talking about integration tests, i run test/integration/book_test.rb and it fails giving me the following error message: 1) Failure: test_book_administration(BookTest) [test/integration/book_test.rb:45:in `add_book'' test/integration/book_test.rb:11:in `test_book_administration''
2005 Nov 16
19
Concerns over Rails' handling of tests
...new testcase for the new fixture. Overall, I''ve found that trying to test a whole controller leads to multiple fixtures in one testcase and multiple violations of DRY. This also leads me on to my other concern, and that is the practice of testing for the presence of markup in a view using assert_tag. I can''t really see the value in this, and again it seems to violate DRY to me. Why would you want to assert that a tag exists in most cases? For example, given the ArticlePostTest example above, which wouldn''t really do much in the controller, and simply pass to the view for the...
2007 Mar 22
1
Functional test and flash with an error
...ication.rb. I tried using a regular expression - /#{user.first_name}/ , but that wouldn''t work either user_controller_test.rb 1) Failure: test_create(Admin::UserControllerTest) [/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/assertions/tag_assertions.rb:102:in `assert_tag'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/assertions/tag_assertions.rb:99:in `clean_backtrace'' /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_controller/assertions/tag_assertions.rb:99:in `assert_tag'' test/functional/adm...
2006 Jul 13
10
Problem with flashes staying on between pages
...#can''t login with incorrect password post "/user/login", :user=> {:email => "bob@mcbob.com", :password => "not_correct"} assert_response :success assert_session_has_no :user assert_flash_has :warning assert_tag :div, :attributes => {:class => ''notice''} assert_template "user/login" # Fetch the root and see if the flash notice is still there get ''/'' assert_response :success assert_template "descr/index" assert_flash_has_n...
2006 Jun 14
0
Functional test problem
...ough through a list of users in a fixtures file, and test against each one, but it''s doing something very weird. Here''s the basics of the test def test_index_user User.find(:all).each do |user| get :index, {}, {:user => user.id} assert_response :success assert_tag :tag => "div", :attributes => { :id => "usermenu" }, :content => /Hello\s#{user.login}/ end end What''s happening is that it''s failing, saying: expected tag, but no tag found ma...
2006 Apr 28
1
how do I test links in templates?
Hello everyone! Sorry, if it''s stupid question, but I can''t figure out how to do this. I have a set of statements, for example, ''login page should have a link to register new user'' and ''login page should have a link to password recovery''. How do I transform it into tests? Where it should go? It does not look like functional tests or
2008 Jul 14
3
How to assert a simple link (testing)
<%= link_to ''my_profile'',:controller => ''users'', :action => ''show'', :id => current_user.id %> <a href=''http://localhost:3000/users/show/2''>my_profile</a> What is the easy and simple way to assert this link in testing. -- Posted via http://www.ruby-forum.com/.
2006 Feb 13
9
Selenium. Replacement for traditional rails functional test?
Hi list I''ve got a bit of a philosophical question. After just having discovered Selenium /Selenium IDE and the rails selenium plugin I''ve realized that it''s a whole lot easier to do functinoal testing than writing the traditional rails functional tests. However it implies that the development database consists of standardized test data (e.g the test & dev
2006 Aug 15
2
Unit Testing Problem
I''m having a bit of difficulty when testing my models, I''ve read a few times the testing chapter in Agile web development with rails and at http://manuals.rubyonrails.com/read/chapter/27 but i''m still unsure of what I should be testing. Firstly I''d like to be able to test things like my email validation using lines such as assert User.new(:email =>