Displaying 20 results from an estimated 2000 matches similar to: "How to DRY up controller action spec with different params."
2007 Apr 11
12
redirection doesn''t get detected well?
I''m doing a redirect in one of my controller actions and somehow I can''t
spec it, see this pastie: http://pastie.caboo.se/53120.
When following the link from a browser I''m being redirected to the right
page.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2007 May 11
2
spec a replace_html with a partial
I wanted to use ARTS to add RJS in a behaviour driven way to my
application, but I''m having some trouble asserting a replace_html with
a partial.
I''ve created a pastie (http://pastie.caboo.se/60694) which contains
the RJS I want to spec, the spec which I already wrote and its failure
message.
I''m currently using RSpec-0.9.2
2007 Oct 17
9
@session['user'] vs session[:user]
This might seem really simple to some but just wanted to ask: what is
the difference between @session[''user''] and session[:user] ? and how
would you use each?
And another question, I have the following code:
def get_customer
if @session[''customer'']
@c = Customer.find(@session[''customer''])
end
end
private
def
2011 May 25
1
warning: toplevel constant SomeController referenced by Admin::SomeController
This issue has been discussed before (http://www.ruby-forum.com/topic/
125392) and after spending a while debugging through this, I still
don''t have a solution. Lets try again?
I have two controllers, SomeController and Admin::SomeController. When
SomeController is loaded first (which happens under spork, found out
by editing ActiveSupport::AbstractController) I get warning: toplevel
2007 Jan 31
1
help please!
Hi,
I''ll appreciate insight on this one... it''s causing me some pain on my
production env.
<%= link_to "something",
:controller => "somecontroller",
:action => ''someaction'',
:id => someid,
:favorite => is_a_favorite %>
I added a boolean :favorite to the URL arguments.
THis has always worked well under my dev
2014 May 02
0
What does assign method do in testing ?
*assigns* - _Any objects that are stored as instance variables in
actions for use in views._
(http://guides.rubyonrails.org/testing.html#the-four-hashes-of-the-apocalypse)
I have a code :-
test "should update line_item" do
patch :update, id:@line_item, line_item: {
cart_id:@line_item.cart_id, product_id:@line_item.product_id}
assert_redirected_to
2013 Sep 23
1
redirect on browser success, but redirect on functional test is error
line_items.yml:
one:
product_id: 1
cart_id: 1
quantity: 1
carts.yml:
one: {}
product.rb:
has_many :line_items
cart.rb:
has_many :line_items, dependent: :destroy
line_item.rb:
belongs_to :product
belongs_to :cart
line_item_controller.rb:
def destroy
@line_item = LineItem.find(params[:id])
@cart = @line_item.cart
@line_item.destroy
respond_to do |format|
format.html
2006 Sep 26
0
Find Returning String Instead of Integer?
Any ideas on why this is? The quantity field in mysql is INT, but I get
back a string? This is preventing me from using the increment method.
>> @cart = Cart.new
=> #<Cart:0x2730f40 @new_record=true, @attributes={}>
>> @cart.items << Item.find(:first)
=> [#<Item:0x272d6ec @attributes={"vendor_id"=>"1",
2009 Apr 24
4
Undefined method "redirect_to" in before_filter
Code sample:
class SomeController < ApplicationController
before_filter do |c|
add_crumb "Blah", "/blah" #breadcrumbs plugin
redirect_to :controller => "foo", :action => "bar" unless c.send
(:has_package?)
end
# Rest of the controller...
private
def has_package?
# A bunch of logic work to check to make sure
# somebody''s session contains
2007 Jan 05
2
Using RESTful routes in controller tests
Why can''t I use the RESTful route helpers in my specs?
In my controller I''m doing a redirect: redirect_to list_path(:id =>
@item.list_id)
Now when I write: controller.should_redirect_to list_path(:id => 2)
I''m getting the following error:
NoMethodError in ''POST on /lists/2/items should redirect to index on
succesful POST''
You have a nil object
2012 Dec 01
6
Why does 'extend ActiveSupport::Concern' cause `undefined method 'recycle!'`?
Working on Rails Engine.
I want to make the controllers customizable whereever the Rails Engine is
used.
Therefore, I was trying to use `extend ActiveSupport::Concern` on the
Engine controller class and include it in MyRailsApp.
https://gist.github.com/4185823
# code in my rails engine
moduel MyEngine
class SomeController
extend ActiveSupport::Concern
def engine_some_method
2007 May 03
6
RSpec 0.9.2
Behind every great release is a maintenance release.
Go get it while it''s hot.
We''ve also reworked the website a little - trying to scare off fewer people.
Aslak
2007 Apr 19
5
Best practice thoughts: Model helpers, mocks
Hello! I''m pretty new to unit testing, and have only been using RSpec
for a few weeks. I found that for my controller specs, my setup
methods were getting very long building mocks/stubs for all the model
objects I needed to work with.
I''ve started creating helpers like the following for each of my
models. The "min_" methods are short for "minimum", and
2007 Jan 18
2
How to use API from AWS -- help!
I''m building a users web service (direct dispatching) that will (I hope)
allow several other applications to manage the same pool of users. Plus
it will act as a single-sign-on solution for what I''m doing. But I''m
having difficulty accessing the UserAPI. Here''s what I''ve done so far:
$> rails usermanagement
- "usermanagement" is the
2016 Aug 04
2
Re: Libvirt: dynamic ownership did not work
Am Do, 4. Aug, 2016 um 5:07 schrieb Michal Privoznik
<mprivozn@redhat.com>:
> On 04.08.2016 13:59, Jonatan Schlag wrote:
>>
>>
>> Am Do, 4. Aug, 2016 um 1:38 schrieb Michal Privoznik
>> <mprivozn@redhat.com>:
>>> On 04.08.2016 12:12, Jonatan Schlag wrote:
>>>>
>>>>
>>>> Am Do, 4. Aug, 2016 um 11:32
2016 Aug 05
0
Re: Libvirt: dynamic ownership did not work
On 04.08.2016 20:28, Jonatan Schlag wrote:
>
>
>> Then the other option that comes to my mind is a race with somebody else
>> on the system. You can attach gdb to the daemon and set breakpoint to
>> virSecurityDACSetOwnershipInternal(). In the arguments you should see
>> the path eventually among with uid:gid.
>>
>> BTW: what's the domain XML?
>
2004 Aug 08
0
SOLVED: Roaming profiles not updating XP
I have run into the EXACT problem; I also may have the solution; I wish I could give you a technical describtion, but I can't. All I know is what worked. Go into Services in the administrative panel of Windows XP and set any service relating to nVidia to Manual startup instead of Automatic. This does not interfere in anyway with any of nVidia's functions in my experince. You can also
2003 Jul 01
0
Acom 200 B/D/E
Hey Has anybody dealt with any of these products?
They Seem to be at a good price point. but I've never used one so I was
hopeing that sombody here Might have some insight. Their configurations are
as follows.
ACOM200B: 2 Port FXS
ACOM200D: 2 Port FXO
ACOM200E: 1 FXO and 1 FXS
This looks to me that this product would be a better solution then the
linejack would be. and according to this
2009 Jun 14
3
Basic AJAX Response (Mootools)
Hi,
I''ve done AJAX calls to Rails'' Controllers before yet never required to
generate a response back to the view. In this respect, I have tried to
keep it moronically simple and just add a node to see that it works, yet
the response doesn''t come through / isn''t interpreted as it should. Long
story short, code :
// Have to use Mootools to integrate a
2008 Mar 08
7
ridding away with do_request
I''m heading out of town, but had a quick thought I wanted to share.
Rather then using ambiguous named request helpers in controller specs
like "do_request", I''ve been using more readable helpers like
"post_create".
For example...
describe ProjectController do
def post_create
post :create, ...
end
before do
end
it "creates a new