Displaying 20 results from an estimated 1100 matches similar to: "strange error on mock proxy"
2011 Aug 09
0
Devise, RSpec and Webrat
My app is builded with rails 2.3.12, rspec-rails 1.3.2, webrat 0.7.3.
My spec_helper.rb
ENV["RAILS_ENV"] ||= ''test''
require
File.expand_path(File.join(File.dirname(__FILE__),''..'',''config'',''environment''))
require ''spec/autorun''
require ''spec/rails''
require
2008 Aug 19
5
RSpec raising routing errors where Rails doesn''t?
Hopefully someone here can help me figure out why the ERB:
<% form_for(@fund, :url => {:host => PRIVATE_HOST}, :html => {:class
=> ''fund'', :multipart => true}) do |f| %>
raises an error in my specs:
No route matches {:action=>"index"}
but works fine in my app and generates the following, desired HTML:
<form
2008 Jan 15
0
Problem with ruby-debug and rspec
So i''ve been getting this same thing with both rspec 1.1.1 and now with 1.1.2.
ruby-debug works with i''m in the application code, but not when i''m in
the ''spec'', or spec helper methods i''m loading. Basically any command
which should normally work like p, or pp, gets passed through to a
method_missing.
I''m kind of stumped on this
2007 Dec 12
3
undefined method: controller_name
With rspec 1.0.8 I have a spec in the directory:
spec/units/controllers/application_controller_spec.rb
require File.dirname(__FILE__) + ''/../../spec_helper''
class DummyController < ApplicationController
def index
raise "Prevent index from rendering"
end
end
describe ApplicationController, "Handling errors in production",
:behaviour_type =>
2007 Dec 13
16
"Tricks" for testing after_create callback???
I''ve got a model Message, which needs to send an email using action
mailer after it''s first saved in the database.
I want to pass the model to the mailer which then uses methods on the
message model to render the email.
So the natural way to do this is in an after_create callback on the
Message model.
But I can''t see an easy way to test this. Here''s my spec
2007 Jul 17
5
habtm confusion
Hello friends!
I am trying to make a database that will have a group of people set to
committees, and a person can be in multiple committees, and a committee
obviously has multiple people. The people are senators at my
university. These are my current models:
senator.rb:
--
class Senator < ActiveRecord::Base
validates_presence_of :first_name, :last_name, :floor
has_and_belongs_to_many
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone,
I am relatively new to rspec and I am running into a wall in testing my
views. I have a RESTful resource Contracts with a nested resource of
Line_items.
I am trying to figure out how to test the "edit" form of the Line_items.
What complicates this is the nested routing and how to account for it,
and that there is a partial form (_form.haml) that both the edit.haml
and
2010 Jul 16
31
Added associations but don't see generated methods
Hi,
I''ve got a Rails app working that includes two two classes, etc.:
Expense & Vendor. I eventually learned that the mental concept I had
of their relationship should be express in Rails as:
class Expense < ActiveRecord::Base; belongs_to :vendor; end
class Vendor < ActiveRecord::Base; has_many :expenses; end
2007 Jul 06
3
stubbing helper methods for View specs
Hi there
I have several view specs, that include the following snippet in
their "before" block to stub the methods by acts_as_authenticated
before :each do
@u = mock_model(User)
@u.should_receive(:name).and_return("Hans Muster")
template.should_receive(:logged_in?).and_return(true)
template.should_receive(:current_user).and_return(@u)
end
this
2007 Apr 30
1
collection_select - prepending a "any" option
Say I have a normal <SELECT> tag being generated thusly:
<%= collection_select :task, :id, Task.find(:all), :id, :name %>
what is the easiest way to add a "ANY" option to the top of the option
list? I know Task.find(:all) returns a collection object, so is there
a unshift() for that?
well OK I tried:
Task.find(:all).unshift([:id=>0,
2006 May 30
0
Problems when applying search to filter rows.
Hello,
I am trying to create in the main Layout of the application fields of
selection of fields of the model, and other to insert its value. Next I put
a search button, with the idea to leak by the search in the view of the
model where it executes this button. I have generated the views with
ajaxscaffold.
I do not know if what I try to do it does of this form or another one.
My code is the
2007 Nov 28
6
textmate bundle
Does anyone else have issues running rspec textmate bundle? I''ve got
revision 2997, but the blasted thing just won''t run.
It is checked out to my /Users/zdennis/Library/Application
Support/TextMate/Bundles/RSpec.tmbundle
When it runs I get the below error...
"textmate" is not a valid class name
2008 Dec 01
1
Undefined method "full_description" when trying to run "rake spec"
Hello guys,
I''m getting this weird error when trying to run the specs using "rake spec":
/home/mauricio/NetBeansProjects/talkies/vendor/rails/actionpack/lib/action_controller/test_process.rb:471:in
`method_missing'': undefined method `full_description'' for
#<Spec::Rails::Example::ControllerExampleGroup::Subclass_73::Subclass_9:0x7f5fdca4a810>
2007 Nov 21
9
''it'' duplicate example: BUG
I svn up''ed this morning, to get the following message with rake spec:
/Users/smt/src/web/urbis/trunk/vendor/plugins/rspec/lib/spec/example/
example_group_methods.rb:96:in `it'': Duplicate example: ''should
contain the total number of messages'' (RuntimeError)
Anyone have any ideas why this might be going on? My specs were all
passing last night.
Let me
2006 Mar 31
18
Modelling Foreign Keys
Can someone point me to a reference or tutorial that shows how to map
foreign key relationships in the model?
For example given:
Users
id
name
email
Posts
id
user_id
title
How do I associate user_id with users.id in the Post and User models?
has_many and belongs_to don''t seem to do it.
--
Posted via http://www.ruby-forum.com/.
2008 Jul 21
6
form_for and select ( => f.select)
Hi All
I''m trying to combine the from_for and select helpers
Right now I have
form_for :service, :url => ...... do |f|
select("abc", "xyz_id", @my_arr.collect {|item| [ item, "bla" ] },
{:prompt => "opt1"} )
....
end
What I want to do is something like
....
f.select("abc", "xyz_id", @my_arr.collect {|item|
2007 Nov 09
9
fixture_file_upload and edge rspec?
Hi all,
I had some specs that were using fixture_file_upload that were
passing just fine. Then I froze edge rails to get some 2.0
functionality, then a I upgraded to trunk rspec to deal with
uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
After a couple other of tribulations, I have now gotten down to just
a couple of not passing specs, all using the fixture_file_upload.
2006 Jul 08
10
A rant about parameters
Guys,
I''ve been chasing a problem with country_select for the past few hours
now. My intention was pretty simple...use the following line in a form:
<p><label for="country_region">Country</label>
<%= f.country_select :country_region, "United States" %></p>
However, for the life of me, I couldn''t get it to work. I kept getting
2009 Feb 25
9
local variables in partials lead to NameError
I know I must be doing something dumb, but I can''t seem to send a
local variable to my partial. The below code leads to the following
error:
NameError in Residential_listings#new
undefined local variable or method `foo'' for #<ActionView::Base:
0x3fb53f8>
I am trying to call the variable ''foo'' in a partial called
_attachment.html.erb, which is nested in
2013 Mar 24
5
Rails 4.0 has_many_through and fields_for
Hi all, I am trying to reproduce rails 3.2 behaviour with fields_for and
nested attributes.
class ControllerAction < ActiveRecord::Base
has_many :interactions, dependent: :destroy
has_many :roles, through: :interactions
scope :controllers, lambda {|name| where("controller_name_id = ?",
name)}
scope :actions, lambda {|name| where("action_name_id =