Displaying 20 results from an estimated 30000 matches similar to: "render :action apparently invalid"
2010 Jun 14
8
Default Test library
Along the same lines as the default javascript library discussion [1],
why don''t we switch the default test library to RSpec? The stats [2]
posted by Xaviar in the other thread seem to support that RSpec is the
preferred way to test.
[1] http://groups.google.com/group/rubyonrails-core/browse_thread/thread/e9b9cf2233d9a59b
[2] http://survey.hamptoncatlin.com/survey/stats
--
You received
2011 Aug 28
3
rspec-rails render_views doesn't render layouts? / how to check flash isn't rendered
I''m trying to test that "static" pages (they''re ERB, but get cached),
generated through rails, don''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
2007 Dec 07
4
strange error on mock proxy
I''m banging my head over this really strange error in a view test when
I run "rake spec". The weird thing is that I don''t get the error when
I run the spec file by itself.
Here is the spec (I know, fixtures are the devil):
describe "/units/new.html.erb here" do
fixtures :units, :accounts, :groups
it_should_behave_like
2009 Jan 27
2
[RSpec] Error when returning multiple values from a stub
Hey guys. I''ve just found some odd behaviour within RSpec 1.1.12 , and
would like to know whether this is a bug, or I''m doing something wrong.
When I give multiple return values to a stub, like this:
SubtitleFile.stub!(:new).and_return @sf1, @sf2
RSpec complains:
Mock ''SubtitleFile_1001'' received unexpected message :size with (no
args)
However, if I
2011 Aug 05
5
named context or calling include_context with block?
Hello,
I''m playing around with Rspec again after going from test/unit to
rspec then back to test/unit... :) Right off the bat, I find myself
wanting to do something like this: https://gist.github.com/1128091
Basically, I want to name a context, then call it later by name,
passing a block to it.
Or in other words... what is the best way to DRY this code?
2010 Nov 29
0
[TDD] [Rails] - Rspec test for application_helper.rb fails when trying to access application_controller method.
In a method named logo in my application helper, I reference an application controller method (current_account) that has been marked as a helper method with the following syntax:
helper_method :current_account
When I test out the setup in the browser (without rspec), rails is happy with this setup.
However, when I run the spec, the spec won''t pass and gives me the following error:
2007 Apr 17
8
problem with rspec_on_rails and @controller.should_receive(:render) in trunk
Hey guys!
I am using rspec trunk, and I am having a little problem with the
latest version. (I am quite sure this worked with an older version
about a week ago)
heres the spec:
it "should render the new user form without layout for a xhr request" do
@controller.should_receive(:render).with(:layout=>false)
xhr :get,:new
end
and the controller:
def new
render
2007 May 23
8
Rails Rendering diagnostics.rhtml in Controller Spec
Forgive me if this isn''t the proper list. It''s specific to the rSpec
Rails plugin.
The problem is, some controller actions are rendering the
"diagnostics.rhtml" template when I''m expecting it to render something
else in a controller spec. I''m assuming this is the template that
displays the error message and a stack trace when an error is raised
in the
2006 Nov 14
0
rspec "assigns" and "render"
Hi all,
I''m trying to create some view specs using rspec following the example at
http://rspec.rubyforge.org/documentation/rails/writing/views.html
However, when I put
@person = mock("person")
@person.stub!(:name).and_return ''Joe''
assign[:person] = @person
I get a NameError saying that ''assigns'' is not defined.
Similarly, "render
2011 Jan 14
2
Rspec autotest error
Hi all,
I tried testing with Rspec for first time, following a tutorial.
"rspec spec/" works fine but when I try ''autotest'' it gives me the
error message below. I also made a gist about it: https://gist.github.com/779265
It seems like a redgreen or ZenTest error. I''m using Ubuntu10, Rails3,
Ruby 1.9 and RVM. Any help is appriciated, thanks in advance,
gezope
2007 Aug 01
4
:render expects possible?
Hi,
Is it possible to do the following in a controller spec?
@controller.should_receive(:render).with(:layout => false)
I''ve been trying this kind of thing and it looks like RSpec is messing
with the render calls, and requires you to use render_template instead.
Could we have at least a warning that mentions that parameters passed to
:render expectations are going to be thrown
2006 Dec 30
1
redirect_to(:action => ''foo'') and return
I''m not sure why this is happening, but if I do this in a controller
unless @variation && @variation.quantity > 0
flash[:error] = "Sorry, that product is currently not available."
redirect_to(:action => ''error'') and return
end
rspec tells me
2)
ActionController::DoubleRenderError in ''The Carts controller with an
2007 Jul 28
2
specing a call to render :layout => "some_layout"
I''m trying to specify that an action should be rendered with a given layout
one particular spec.
What I''ve got at the moment is this.
it "should render with the grabber layout" do
controller.should_receive( :render ).with( :layout => "my_layout" )
do_get
end
This doesnt work even though this call to render is being executed.
render :layout
2011 Sep 02
1
Rails 3.1.0 File Upload Rspec Test
I''m having this odd problem that I encountered, today. I want to check
that when I upload a CSV file that it does import some records into a
DB. Problem is that sometimes when I run RSpec it seems that it wants
to read the uploaded file as a string, rather than an object that I am
sending with a post request. Here''s a gist of my code:
https://gist.github.com/1187861
With Rails
2008 May 06
1
specifying output of render call
Hello again,
First of all, thanks much for everyone''s input on my question last week
about spec''ing an invocation of super.
Here''s another question that seems resistant to my Google searching:
With this helper method (defined in a module and included in Rails
controllers):
def render_rjs_redirect(url = ''/'')
render :update do |page|
page
2007 Oct 25
0
How to spec a render:update call
Hi folks.
I''m trying to work out how to verify that a controller has called a
render:update block similar to:
render :update do |page|
page.replace_html ''edit'', :partial => ''form'', :locals => { :operation
=> ''edit'', :submit_button_value => ''Update'' }
end
We used to test this with something
2008 May 08
2
Testing render :text without has_text
A controller I''m trying to test simply delivers a text string to the
client, which then demarshalls it to retrieve some objects. I want to
test that the returned string is correct.
I don''t want to compare the string character-by-character with
response.has_text because that ties me to the implementation of the
Marshall class. Instead, I just want to demarshall the string
2011 Mar 03
1
Does RSpec interfere with Pathname#dirname or Pathname#realpath ?
Hi,
I starting a new project, and have run into behavior I cannot
replicate in irb, (i.e. outside of using rspec) when the directory?
returns true, so I thought I''d ask here, in case any one has seen this
badhavior.
ruby-1.9.2-p136
rspec (2.5.0)
rspec-core (2.5.1)
rspec-expectations (2.5.0)
rspec-mocks (2.5.0)
When I try to run this spec:
require Pathname(__FILE__).ascend { |d|
2010 Sep 23
2
rspec runner setting $KCODE considered harmful?
I ran across a problem today in which some code ran fine in regular
operation but failed in a test case. I scratched my head and thought "why
would running from within the test harness change the behavior of my code?"
Clearly it was the Heisenberg uncertainty principle in action! :)
I discovered the root cause was that the rspec runner is setting the magical
ruby global, $KCODE, to
2009 Nov 02
0
testing Rake tasks with FakeFS
Jake Benilov wrote:
> Hello Ben,
>
Hi Jake,
I hope you don''t mind but I am copying this response to the rspec-users
list in case any one else is able to shed more light on it.
> I have a bit of a newbie question regarding fakefs; I want to test Rake
> tasks using fakefs and rspec:
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> require