Displaying 20 results from an estimated 38 matches for "assert_templ".
2012 Nov 26
8
why functional test does not get failure?
The test:
test "should get new" do
get :new, :room_id => @room.name
assert_template(:ne)
end
the template new does not exists but the test does not get failure.
Why?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public...
2005 Dec 18
1
assert_template fails?
Hi All,
I have a seemingly simple problem - but can''t figure out the problem. I
have a simple functional test like so:
def test_should_show_search_dropdown
get :index
assert_response :success
assert_template :search
end
Inspite of having search.rhtml in /app/views/layout, it fails with an error:
1) Error:
test_should_show_search_dropdown(SearchControllerTest):
NoMethodError: undefined method `include?'' for :search:Symbol
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_co...
2006 Jul 17
5
Functional Tests misbehaving with Globalize
...s 1.1.4, and I''ve only
recently adopted a strong love for testing. Now my models are 100%
tested (I must note that I do not make use of any translations in the
database yet), and I''ve now started with functional tests before
moving on to integration tests.
It seems I cannot "assert_template" without getting results like:
1. assert_template "index.rhtml" yields:
NoMethodError: You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]
and 2. assert_template "index&quo...
2006 May 13
0
integration: assert_template() always fails...
Hi Coders :-)
Maybe somebody can help...
My integration tests always fail when using assert_template()
class ShopTest < ActionController::IntegrationTest
def test_very_simple
get("/shop/index")
assert_success
assert_template("/shop/index")
end
end
the "/shop/index" is a valid url which renders flawlessly in the browser. however, the test wi...
2006 May 06
1
depot test-driven development exercise
...:class => ''addtocart'' %><br/>
</div>
<div class="separator"> </div>
<% end %>
</div>
<%= link_to "Show my cart", :action => "display_cart" %>
5. Change the test so it does "assert_template ''search/search''"
instead of "assert_template ''search/results''".
6. There is no step six.
Was there a better or easier way of accomplishing this task?
Also, why did the book want to test "assert_template ''search/
results'&...
2007 Feb 06
2
Testing RJS actions
Hi all !
This is my test:
def test_destroy_xhr
Article.expects(:find).with("1").returns(@article = mock("article"))
@article.expects(:destroy).returns(true)
delete :destroy, :id => 1, :format => :js
assert_template "destroy.rjs"
end
And my implementation:
def destroy
@article.destroy
respond_to do |format|
format.html { redirect_to articles_url }
format.js { render }
format.xml { head :ok }
end
end
This fails spectacularly:
1) Failure:
test_destroy_xhr(Au...
2006 May 05
1
Agile Rails (1st edition), depot TDD "exercise"
...:class => ''addtocart'' %><br/>
</div>
<div class="separator"> </div>
<% end %>
</div>
<%= link_to "Show my cart", :action => "display_cart" %>
5. Change the test so it does "assert_template ''search/search''"
instead of "assert_template ''search/results''".
6. There is no step six.
Was there a better or easier way of accomplishing this task?
Also, why did the book want to test "assert_template ''search/
results'&...
2006 May 04
6
second assert_tag failling in rails integration test
Hi all,
I''m fairly new to rails and ruby, but I''ve come across an interesting
glitch and I''m not sure whether I''ve just got something wrong with my
assumptions or if it really is an error in the underlying framework...
I''ve created a bare-bones set of tests to show you where the problem is.
What follows are the steps I went through to reproduce the
2005 Dec 23
6
Agile book - test error
...get :add_to_cart, :id => @version_control_book.id <<<
cart = session[:cart]
assert_equal @version_control_book.price, cart.total_price
assert_redirected_to :action => ''display_cart''
follow_redirect
assert_equal 1, assigns(:items).size
assert_template "store/display_cart"
end
And the error n question is:
1) Error:
test_add_to_cart(StoreControllerTest):
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really
wanted the id of nil, use object_id
test/functional/store_controller_test.rb:26:in `test_add_to_...
2006 May 03
1
Nubee Fixtures + Tests problem
...mesheet:
status: 2
start_date: 2006-04-24
cost: 10
employee: 444
id: 10683
charge: 20
My Test :
class AdminTimesheetsControllerTest < Test::Unit::TestCase
fixtures :timesheets
def test_viewTimesheet
get :viewTimesheet,:id=>@timesheets["first_timesheet"].id
assert_template ''viewTimesheet''
end
end
The error :
test_viewTimesheet(AdminTimesheetsControllerTest):
NoMethodError: You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]
test/functional/admin_...
2006 Sep 26
0
some help with functional testing of nested routes
...@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@first_id = products(:first).id
@category_id = categories(:first).id
end
def test_index
# HTTP GET
get :index
assert_response :success
assert assigns(:products)
assert_template ''index''
end
def test_new
# HTTP GET
get :new
assert_response :success
assert_template ''new''
assert_not_nil assigns(:product)
end
def test_create
num_records = Product.count
# HTTP POST
post :create, :product => {:n...
2006 Aug 02
1
REST and functional tests
Just playing around with converting an apps to the new REST goodness in
edge rails, and I''m trying to work out how to convert/write the
functional tests.
Is the recommended way to explicitly use the actions (e.g. get :show,
:id => ...; post :create,..., etc) and test the routes separately, or
duplicate the request, in which case how is that done get "/", :id => 5
2006 Aug 04
2
Functional Testing Anomoly
I have a test method (below).
def test_save_failed
post( :edit, :record => StatusChanger.invalid_data_hash)
assert_response :success
assert_template ''edit''
assert assigns(:record)
assert_equal false, assigns(:record).valid?
end
This particular method is part of a larger set of functional tests. If
I run,
$ ruby controller_test.rb -n ''test_save_failed''
it validates fine. If I run,
$ ruby controll...
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 l...
2006 May 04
3
@products["car"] is not being recognized in my tests!! help
@products["car"] is not being recognized in my tests:
class ProductsControllerTest < Test::Unit::TestCase
fixtures :products
def test_view_product
post :view_product, :id=>@products["car"].id
assert_template "view_product"
...
end
end
products.yml :
car:
id:1
name:test
Does anyone have any idea why its not working?
Im having to do this instead, which is not ideal:
post :view_product, :id=>1
Thanks
Chris
--
Posted via http://www.ruby-forum.com/.
2006 Feb 06
9
tests fine, but fail under rake
...gt;''small''})%>
3: <%else%>
Now the weird thing is, it that this line 2 of list.rhtml shouldn''t get
processed at all for this test:
def test_search
get :search, {:params => {:search_terms =>''comment''}}, @session
assert_response :success
assert_template ''list''
end
so running the test without rake produces the correct result, whereas
running with rake leads to this error. I get another similar template
based error under rake that also doesn''t occur when run without rake.
Has anybody seen anything similar? Have any id...
2012 Mar 22
1
Rspec not loading fixtures
...`touch #{@registrant.pdf_file_path}`
}
@registrant.generate_pdf
@registrant.save!
end
it "provides a link to download the PDF" do
get :show, :registrant_id => @registrant.to_param
assert_not_nil assigns[:registrant]
assert_response :success
assert_template "show"
assert_select "span.button a[target=_blank]"
assert_select "span.button a[onclick]"
end
after(:each) do
`rm #{@registrant.pdf_file_path}`
end
end
**** And here is what in various directories:
spec/fixtures/partners.yml - whi...
2006 Oct 21
6
test_create gets 200 instead of :success
...be added.''
render :action => ''new''
end
end
Setting breakpoints at different places in the above code indicates that
my test is going through the rescue section.
Here''s the test code:
def test_new
get :new
assert_response :success
assert_template ''new''
end
def test_create
num_borrowers = Borrower.count
post :create, :borrower => {:SSN => ''000'', :LastName => ''Anyone''}
assert_response :redirect # gets 200 (OK) instead of 302
(Found)
assert_redirected...
2010 Nov 16
4
view.should render_template best practices?
I''ve been looking for the definitive answer for months now, and the
RSpec book doesn''t touch on it at all:
How do we now handle stubbing out rendering of partials in view specs
in RSpec2?
I have a large (35K+ lines of views and related specs) that I''m trying
to upgrade to Rails3/RSpec2. My views use partials pretty extensively
and this issue is a huge blocker for me.
2006 May 06
0
RE: Rails Digest, Vol 20, Issue 156
...:class => ''addtocart'' %><br/>
</div>
<div class="separator"> </div>
<% end %>
</div>
<%= link_to "Show my cart", :action => "display_cart" %>
5. Change the test so it does "assert_template ''search/search''"
instead of "assert_template ''search/results''".
6. There is no step six.
Was there a better or easier way of accomplishing this task?
Also, why did the book want to test "assert_template ''search/
results'&...