Displaying 20 results from an estimated 1000 matches similar to: "Help with xhr request in integration tests"
2007 Nov 15
2
Story adapter and SQLite Was:What command to run all stories?
Hi, by switching to MySQL from SQLite, it fixed the problem. I ran
rdebug on it and it is trying to call
I ActiveRecord::Base.connection.begin_db_transaction. from
ActiveRecordSafetyListener.scenario_started. I don''t think SQLLite
likes transactions.
Ed
On Nov 15, 2007 10:56 AM, Ed Howland <ed.howland at gmail.com> wrote:
> If I run the story stand-alone, I get:
> ruby
2007 May 10
2
Problem with translator
Hi,
Just installed 0.9.4 (from 0.8 series) and ran the spec translator. It
messed up specs that had the should include() where the argument to
include is a string (using no parens for the arg)
IOW, given:
context "OldSchool" do
class OldSchool
attr_accessor collection
def initialize
@collection = []
end
def add_new(item)
2007 Jan 12
2
After upgrade to 0.7.5, specs are now using the development, not the test DB
Hi,
After I upgraded RSpec from 0.7.4 to 0.7.5, first the gem, then the
Rails plugin, I noticed that when I ran my spec/models, the fixtures
were overwriting the data in the development environment DB, not the
test one. The test environment was being used prior to the upgrade.
I am using SQLite3 and an in-memory db for the test environment.
Any help would be appreciated.
Thanks
Ed
--
Ed
2008 Jun 02
2
get method under 1.1.4 in Stories is undefined
HI,
After I upgraded to RSpec 1.1.4 (from git), my stories all failed. I
was using Webrat and the first thing I noticed was the ''visits'' method
was gone. I then backtracked to just using ''get'' and got the same
undefined method exception. I confirmed it was still working in 1.1.3
Eventually, I got it to work doing this:
in my first Given:
@app =
2006 Sep 11
1
Aliasing type method in Mocha
Hi, (Mocha and Stubba are great, btw.)
Is there any way to alias the call to .type in Mocha? The issue is
that AR effectively aliases the normal type method for the Column
class (for whatever Adapter.) My code is reflecting on the adapter
methods to iterate over the columns in a particular model. This makes
it hard to write test code that stubs out columns and mocks my models.
E.g.
cols =
2007 Nov 20
1
How to represent Story of Life grid in Then clause
In this story from Dan''s Game of Life:
Scenario: the grid has three cells
Given 3 x 3 grid
When I create a cell at 0, 0
And I create a cell at 0, 1
And I create a cell at 2, 2
Then the grid should look like:
XX.
...
..X
How do you set up matchers for the grid at the end. Are all the
indented lines after a Then passed to the Then matcher as separate
2007 Apr 26
2
assert_select with respond_to JS or xhr?
Hi everyone,
I am a bit confused with xhr? and respond_to.
I have the folloing code in my view to update the ''emails'' ID
link_to_remote(image_tag("refresh"), :update => "emails",
:url => { :action => "list_emails" })
in the controller side i have somthing like :
[..]
respond_to do |type|
type.html { render :action
2007 Feb 08
3
testing ajax responder actions
I have an Ajax responder method which uses respond_to to make sure it
only works with Ajax. I''m having trouble figuring out how to call this
action successfully. I''m using Rails 1.2.x. Any thoughts?
--
Cheers,
Kevin Williams
http://www.almostserio.us/
"Any sufficiently advanced technology is indistinguishable from
Magic." - Arthur C. Clarke
2006 Oct 25
5
Mocha, Stubba and RSpec
Hi,
I''ve been reading with interest the threads trying to integrate Mocha
and Stubba with RSpec. So far, I''ve made the two changes in
spec_helper.rb suggested, but discovered another one that neither of
the archives mentions:
If you use traditional mocking: object = mock or the stub shortcut
: object = stub(:method => :result), you run into namespace conflicts
with
2008 Mar 31
1
How to make a ajax (xhr) redirect?
Hi all,
In my application, I want seamless degradability so I use request.xhr?
to check whether a request is an ajax call. However here and there, I
need to use redirect_to - in this case the request is not xhr anymore,
and the check doesn''t work as expected. Is there a way to make xhr-
like redirect (which allow to get to another controller+action)?
Thanks,
- Chuong
2006 Jul 24
0
Why doesn''t default_url_options :anchor => ... work for render
In my action, I test to see if a particular button was clicked, if it
was, I want the template to render, but to go to a particular anchor,
like #company.
E.g.
if params[''add_company'']
default_url_options :anchor => ''insurance''
end
#... logic
# then default render
In the add.rhtml:
<a name="company">
<%= text_field model, company_name
2006 May 23
0
RJS replace adding multiple inputs
Hi,
I have a classic problem. I want to replace a hidden field inside a
form with a hidden field with some value when a link_to_remote is
pressed. In the link''s action rjs, I''m doing the following:
Assume my form has the following field already
<%= hidden_field(''client'', ''company_id'') $>
So I have a bunch of companies in a list with
2006 Jul 06
1
multiple xhr requests
Hi I have a window that looks like this
--------------------
| | Enter
--------------------
That box will take a command that the user enters and runs it on a
server in the background loading a new window for the user to view the
results. Is there a way to take multiple xhr requests so that the next
request the user enters , a new window will pop up right away, instead
of
2006 Jun 24
5
request.xhr? vs. respond_to
Searched around this forum, but didn''t find an answer for this question.
Can you help this newbie understand any overlap and/or difference
between request.xhr? and respond_to?
If request.xhr? is true, should I expect it wants.js below?
respond_to do |wants|
wants.html { redirect_to(person_list_url) }
wants.js
wants.xml { render :xml => @person.to_xml(:include
2006 Jul 12
3
request.xhr? is false after redirecting an AJAX request?
Dear everybody
I''m trying to develop a web application that makes use of AJAX, but also works
if a user has no (or doesn''t want to use) JS. For normal requests, this is
pretty easy. Almost every action ends with
render blahblah, :layout => !request.xhr?
This way, I can use the same action to render a full page (with layout) as
well as rendering an AJAX request (only the
2007 Dec 03
8
automatic 'verify :xhr => true' for methods ending with _xhr
hey guys,
i am writing a couple of actions which are only used with an xhr. I
''protect'' them all against a direct access with the ''verify'' method in
the controller
verify :only => ..., :xhr => true
it would be cool if the system would automatically recognize the xhr
actions and protect them ... i want to postfix methods with ''_xhr'' and
2008 Jun 05
2
xhr :post giving wrong number of arguments on rails 2.1?
Getting a strange error.
In a story I have the following step:
When "I submit a search name" do
xhr :post, ''/searches'', {:search => {:given_name => "bob", :family_name =>
"smith"}}
end
I am getting:
ArgumentError: wrong number of arguments (4 for 3)
stories/searching_story_spec.rb:45 in "I submit a search name"
But I only
2007 Nov 15
5
What command to run all stories?
Hi, I''ve been following this thread and I can get the example stories
to run with the ruby command. But I''ve been unable to get the example
from http://blog.davidchelimsky.net/articles/2007/10/25/plain-text-stories-part-iii
to run with all.rb
ruby stories/all.rb
/home/edh/story/stories/additions/steps/addition_steps.rb:2: undefined
method `steps_for'' for main:Object
2006 Jul 24
0
Redirect/rendering out of xhr
Hi,
I have a link_to_remote to an action in my controller, which has an rjs file
associated with it. In the action (where @request.xhr? is true), I have
tried to redirect to another page or render to another page. When I do this,
the log says all the redirections/renders were successful, but I remain on
the same page. My rjs file at least does not execute though, which is good.
Any ideas on
2007 Jan 03
0
submit_form for Ajax via xhr
Railsters:
The assert_select system has a submit_form method that reads your
current page''s form, and submits all its fields with their data. This
works great for Test Driven Development because it tests your current
page''s form and your controller''s action at the same time.
Is there a submit_form that calls xhr, to submit a FORM thru Ajax? How
easy would that be to