Displaying 10 results from an estimated 10 matches for "render_views".
2011 Aug 28
3
rspec-rails render_views doesn't render layouts? / how to check flash isn't rendered
...#39;t render any stray flash notices left over by
the authentication system (Devise) or wherever else.
I''ve tried writing this controller spec, but it appears that response.body
only renders the template, not its layouts?
describe "so that static caching can be used" do
render_views
specify "flash notices are not rendered" do
flash[:notice] = "flash boo"
flash[:error] = "flash boo"
flash[:alert] = "flash boo"
get :show, :page => ''privacy_policy''
response.body.should have_content('...
2011 Mar 06
2
render_views and render_to_string
Hey guys. One of my controller actions uses #render_to_string to send back a
JSON response.
When I try to spec this, Ruby raises a NoMethodError, saying that
#render_to_string doesn''t exist in my controller action.
Here''s the controller action, spec, and output:
http://pastie.org/1640962
Any idea what I''m doing wrong? Thanks,
Nick
-------------- next part
2011 May 27
14
[rails] undefined method `model_name' for NilClass:Class
Never seen the error above before, code:
describe "edit action" do
it "edit action should render edit template" do
food = Food.create(:name=>''mooo'') #
Food.any_instance.stubs(:valid?).returns(true)
get :edit, :id => food.id
response.should render_template(:edit)
end
end
-------------- next part
2010 Aug 30
1
undefined method `route_for' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:
....0.0.rc, rspec -v = 2.0.0.beta.18 (hope they
should match each other).
my test is here: spec/controllers/posts_controller_spec.rb and i ran
it with command: rspec spec/controllers/posts_controller_spec.rb.
after all, test is:
require ''spec_helper''
describe PostsController do
render_views
describe "route generation" do
it "should be successful" do
@post = Post.new(:title => ''blalbla'', :name => ''adfsdfsdf'')
@post.save
route_for(:controller => "posts", :action => "show", :i...
2013 Nov 22
2
Cancan Rspec load_and_authorize_resource
...ile)
However, my tests are steel passing with command rspec spec/controllers/
Some info:
ads_controller.rb:
class AdsController < ApplicationController
load_and_authorize_resource except: :create
end
ads_controller_spec.rb:
require ''spec_helper''
describe AdsController do
render_views
describe ''Guest role'' do
it "should not display link to new ad" do
visit ads_path
page.should_not have_content(''New'')
end
end
end
Gems:
rails (4.0.0),rake (10.1.0),cancan (1.6.10),
* rspec-core (2.14.5)
* rspec-expectations...
2011 Jan 17
1
Using integrate_views for all controller specs
Is there a way to always use integrate_views for all controller specs?
I hate having to remember to insert that line into each one.
Thanks,
Joe
2011 Jul 28
2
rails 3 routing error
...;
root :to => ''pages#home''
get "pages/home"
get "pages/contact"
get "pages/about"
get "pages/help"
end
spec/controllers/sessions_controller_spec.rb:
require ''spec_helper''
describe SessionsController do
render_views
describe "GET ''new''" do
it "should be successful" do
get :new
response.should be_success
end
it "should have the right title" do
get :new
response.should have_selector(''title'', :content => &...
2011 Jul 25
6
What does using a lambda in rspec tests accomplish?
Here is the code in question:
describe UsersController do
render_views
…
…
describe "POST to ''create'' action" do
describe "failure" do
before(:each) do
@attr = { :name => '''', :email => '''', :password => '''',
:password_con...
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
2010 Jun 20
10
RSpec 2 view example: render_template
On http://github.com/rspec/rspec-rails under "View specs" there''s an
example
describe "events/index.html.erb" do
it "renders _event partial for each event" do
assign(:events, [stub_model(Event), stub_model(Event)])
render
view.should render_template(:partial => "_event", :count => 2)
end
end
Is this indeed correct? From the