Displaying 20 results from an estimated 400 matches similar to: "Debugging with gdb"
2008 May 06
3
a R_PV problem
Dear all,
When using gdb to debug my C code, I use R_PV to show the content of
SEXP variables:
SEXP sexp; // it is a data.frame
SEXP colNames = getAttrib(sexp, R_NameSymbol);
A strange thing is that after halting the program:
(gdb) p R_PV(colNames)
does not show the content of colNames. I am positive my code is right
because if I insert "PrintValue(colNames);" in the c code,
2009 Jun 25
1
R data inspection under gdb?
Hi, everyone. I'm trying to debug an R-module, written in C, and I'm using
gdb for this.
How can I print "standard" R objects from within C code?
BTW, I'm familiar with the advice to use R_PV given in Writing R Extensions,
but it's not working for me. E.g., I get
(gdb) p R_PV(x)
$1 = void
and yet
(gdb) p *x
$2 = {sxpinfo = {type = 16, obj = 0, named = 0, gp = 0,
2008 Jun 07
2
When to send "post" and "get" in blocks.
Hi,
I''m new to RSpec. I have a question about how to write controller specs.
Here''s a code generated by scaffolding (with Rspec).
def do_get
get :index
end
it "should be successful" do
do_get
response.should be_success
end
it "should render index template" do
do_get
response.should
2008 Jan 30
3
Order of the get call and xxx.should
Just out of curiosity, why is that the following .should calls have to
differ to work?
The first is a normal check on the if the user is redirected if not
logged in
=========
it "should redirect the user to the login screen" do
do_get
response.should redirect_to(new_session_url)
end
The second is checking to ensure that the proper user validation method
is called
=========
it
2007 Jun 14
1
rspec will_paginate
Hi Rspec-Users,
I''m not sure if I am correctly specing my index since I''m using
will_paginate.
params[:filter_by] will filter the paginate list accordingly.
Tickets Controller:
def index
@tickets = Ticket.filter_status_by(params[:filter_by],params[:page])
end
Ticket Model:
def self.filter_status_by(status, page, per_page = 10)
conditions = {:status => false} if
2007 Oct 26
3
Specing with Subdomains as Account Keys
How do you go about implementing and rspecing subdomains as account
keys? I''m sure that this must be an issues for others as well.
So I have an app using subdomains as account keys. The Application
Controller sets up @current_company in a before filter. Everything is
done within the context of the @current_company.
After reading about Demeter''s Revenge
2007 Oct 08
6
spec''in controllers request for nested routes
describe PlayersController, "handling GET /saltmines/games/1/players" do
before do
@game = mock_model(Game, :to_param => "1")
@game.stub_association!(:players, :find => mock_model(Player))
end
def do_get
get :index, :game_id => @game
end
it "should be successful" do
do_get
response.should be_success
end
it "should
2007 Apr 20
1
getting controller specs to work on edge
I''m using edge spec, edge rspec_on_rails, edge rails. I just switched to
edge and ran the translator tool and I''m trying to get everything to pass
again. One of my issues is getting render back up and working for my
controller specs, here''s an example:
describe "Requesting /users using GET" do
controller_name :users
setup do
@user = mock_model(User)
2007 Sep 14
2
Testing a nested controller
Hey everyone.
I really stuck on testing a nested controller. I''m trying to make a
request using get and afterwards checking the response by
response.should ...
My routes.rb looks like this:
map.resources :writers do |writers|
writers.resources :notes
end
In my notes_controller_spec.rb
def do_get
writer_id = 1
note_id = 1
get note_path(writer_id, note_id)
end
it "should show
2007 Sep 14
2
Testing nested controller
Hey everyone.
I really stuck on testing a nested controller. I''m trying to make a
request using get and afterwards checking the response by
response.should ...
My routes.rb looks like this:
map.resources :writers do |writers|
writers.resources :notes
end
In my notes_controller_spec.rb
def do_get
writer_id = 1
note_id = 1
get note_path(writer_id, note_id)
end
it "should
2007 Feb 15
4
defining context(s) dynamically
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Q. Why does code which defines a context work in the
2007 Mar 28
1
extracting common methods out of specs
I have several specs which do more or less the same thing:
describe "GET /users/1/terms" do
controller_name :terms
def do_get
get :index, :user_id => 1
end
it "should be successful" do
controller.should_render :index
do_get
end
...
end
How could I extract this functionality from each spec?
Scott
2007 Sep 30
9
Problems with testing nested routes using mocking
Hello forum
I have there to files
#----- virtual_host_controller.rb
class VirtualHostsController < ApplicationController
before_filter :capture_domain
# GET /domain/1/virtual_hosts/1
def show
@virtual_host = @domain.virtual_hosts.find(params[:id])
respond_to do |format|
format.html # show.rhtml
end
end
private
def capture_domain
if
2007 Oct 25
1
Mocking/Stubbing help with subdomain as account key
My app uses account_location to set up subdomains as account keys. In
my controllers, all my model operations are scoped through the
@current_person object.
The question is: How do I test this with RSpec''s mocking and
stubbing? Basically, I need to test that @current_person.things is
getting the find message and returning @thing. I''ve tried stubbing
and mocking
2005 Jun 29
1
Viewing R objects in gdb
I'm trying to track down a bug in some experimental code, where an
object's attribute is getting messed up. This means I'd like to examine
R objects while within gdb.
One of the things I'd like to do is to examine the names of all the
attributes. This is exactly what an example in the R Extensions manual
section 4.11.2 "Inspecting R objects when debugging" does,
2007 Jun 02
7
I''m really bad at controllers, help please.
Hey,
Sorry for so many questions - I''m really bad at this right now.
I''m trying to cover the following code w/ rspec
def index
if params[:user_id]
@user = User.find(params[:user_id])
@messages = @user.messages
end
end
So basically what I''m doing is listing all the messages for a user,
provided there is an id parameter.
describe
2007 Oct 16
3
Controller iterating through returned records and appending to each
I have a controller that gets a list of employees (which has an "include =>
[:salaries, :incentives, :billablegoals, :reviews]"). I then need it to
iterate through each employee and determine their current active goal based
on the "effective date."
After playing around with it a bunch, I got the following to work. Only
problem is that if I remove the "@employees.each {
2007 Nov 21
7
describe AddressesController, "handling GET /addresses" do
Hello,
I''m working with scaffold generated controller test code for handling GET
requests. Address is the model being tested. Address belongs_to Company,
Company has_many addresses.
In my addresses_controller I have:
before_filter :get_company
def index
@addresses = @company.addresses.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml {
2006 Feb 20
0
vpimd, a personal information server
This isn''t even close to ready for release, but in case anybody is
interested, has feedback, finds it useful as is, or even wants to
collaborate...
I''ve been working on a "personal information server", something of a
protocol multiplexer. Right now it serves calendar feeds for:
- a local calendar folder (iCal 1.x''s Library/Calendars)
- rss for local todos
2007 Mar 27
2
mocking/stubbing newbie questions
I''m new to mocking and stubbing. Can someone help me out with the
following? I don''t exactly know why this spec is failing:
describe "GET /users/1/terms" do
controller_name :terms
setup do
@user = mock_model(User)
User.stub!(:find).and_return(@user)
end
def do_get
get :index, :user_id => 1
end
it "should find all terms