def test_account_list # There should be some accounts to test assert @ttrueheart.accounts.count > 0 @request.session[:user] = @ttrueheart get :list assert_success xml = nil assert_nothing_thrown { xml = REXML::Document.new(@response.body) } @ttrueheart.accounts.each do |account| td = REXML::XPath.match(xml, "//td[text()=\"#{account.display_string}\"]") assert_equal(1, td.size) # Unique entry assert_equal(3, REXML::XPath.match(td, 'following-sibling::td/a').size) href = REXML::XPath.match(td, "following-sibling::td/a[@href='/account/activity_list/#{account.id}']") assert_equal(1, href.size) href = REXML::XPath.match(td, "following-sibling::td/a[@href='/account/edit/#{account.id}']") assert_equal(1, href.size) href = REXML::XPath.match(td, "following-sibling::td/a[@href='/account/delete/#{account.id}']") assert_equal(1, href.size) end end
You need to create an account or log in to post comments to this site.