similar to: how can I investigate when a rspec test fails?

Displaying 20 results from an estimated 4000 matches similar to: "how can I investigate when a rspec test fails?"

2011 May 27
14
[rails] undefined method `model_name' for NilClass:Class
Never seen the error above before, code: describe "edit action" do it "edit action should render edit template" do food = Food.create(:name=>''mooo'') # Food.any_instance.stubs(:valid?).returns(true) get :edit, :id => food.id response.should render_template(:edit) end end -------------- next part
2011 Jan 08
9
options_for_select.
Even reading the documentation I can not figure out what is the select_tag difference between this: <% = select_tag (bags [], "options_for_select (bags.collect @ {| bb | [bb.bag_type, bb.id]}, ruser.bags.collect @ {| ub | ub.id}), {: multiple => true,: id => "bags"})%> and this: <% = select_tag "bags [], " options_for_select (bags.collect @ {| bb
2007 Jun 19
5
Problems translating should_render from 0.8.2 to 1.0.5
<font size="2">I''m working on a large Rails site and we want to move from RSpec 0.8.2 to the latest and greatest.&nbsp; So we ran the translator and yet we''re having a lot of trouble translating should_render.<br><br>I found this on the web:<br><br>We will NOT be supporting the following in the new syntax:<br>&nbsp;
2007 Jul 24
6
Mocking Access Control
I''m trying to jump on the TDD/BDD bandwagon, but am having trouble understanding how i should mock my user. The user has a habtm relationship to a roles model (acl_system2 plugin), but I''m not sure how to tell rspec about a model. My code: describe UsersController do integrate_views before(:each) do @user = mock_model(User)
2007 May 23
2
rspec mocha and controller specs without integrated_views
The ability to choose a mocking framework is great as I prefer mocha, but I am have problems. On my controller specs, I am forced to ''integrate_views'' as the following code below shows you, the mocking of views is rspec specific. See stub! versus mocha''s stub unless block_given? unless integrate_views?
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 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
2009 Feb 20
6
How to mock an object defined in the before_filter function?
Hello, I am trying to implement the following scenario, but I am stuck ... The thing is I want to initialize a variable @comment when the stub function "find_comment" is called. The way I do it below doesn''t work, since "before_filter :find_comment" returns true/false and @comment initialization is done inside it. Could you please give me a hint how to do it? One
2007 May 20
9
How to test for exceptions
Hi folks, I''m in the process of converting a Test::Unit functional test to RSpec, but I''ve run into a slight problem. I tried looking through the documentation but I still don''t know what I missed. Thanks in advance, Blake describe VenuesController, "on update" do before(:each) do @venue = mock("venue")
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 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
2008 Aug 26
9
stub_model() and ActiveRecord Associations
Hi all, I have what I thought was quite a simple requirement but something to do with the way ActiveRecord''s associations work is making it quite puzzling. I guess I can sum it up with this failing test: before(:each) do @source_comment = @source.comments.create(:user_id => 1) @target_comment = @target.comments.create(:user_id => 1) end
2007 Jun 11
2
Testing create in Rails controller
Hi All So I am a first-time caller ;-) ... and have been trying to apply RSpec to the depot example in Dave Thomas'' book as I build the application. I am having a problem testing the admin controller create method and cannot quite see where I am going wrong so was hoping for a pointer :-) My spec looks like: describe AdminController do before(:each) do @product =
2007 Oct 11
2
Login testing ideas
I''ve been going through Pat''s example story and noticed that there was no checking for a bad login. I assume this is because that would have made the article bigger and more complicated than it needed to be. So the question that comes of of this is: How do folks normally handle the negative case? My plan was to just use another scenario, but as a new person to BDD/TDD,
2007 Oct 01
15
how to spec views
I''m trying to spec a view but haven''t done much view specing. This view render different partials depending on authentication of the user: annon, admin, player So I I''ll write if conditionals in the view with the partials it "should render signup propaganda for annon users trying to view games" do render "/games/index.rhtml"
2008 Jan 28
2
Could this controller test be made simpler?
In a create controller method I am testing the else clause that occurs when the model is unable to be saved. Sounds simple enough, but because model is created before the save and the form has to be re-filled I now have to stub a model and all the attributes. Since the error messages are displayed I also have to stub some methods within the model that allow the error messages to be displayed
2007 May 28
1
Rails matcher render_template is wrong when using GetText, looking for flexible solution
I have a problem with a mismatch between RSpec Rails and the actual behavior when using GetText, and would be glad for suggestions how to best solve this. When using GetText a failure is reported for the following simplified specification: describe SamplesController, "when requesting /samples" do it "should render index " do get ''index''
2010 Dec 29
1
activeldap anyone using?
Someone use activeldap? I''ve installad the gem but it seems to me that tha latest activeldap version require rails 2.3.8. I use rails 3.0.3 and don''t want to install version 2.3.8. Is activeldap a old gem? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2007 Aug 08
5
Can''t seem to spec a ActiveRecord::RecordInvalid exception properly...
1 def create 2 @user = User.new(params[:user]) 3 @user.save! 4 self.current_user = @user 5 redirect_to user_path(@user) 6 flash[:notice] = "Thanks for signing up!" 7 rescue ActiveRecord::RecordInvalid 8 render :action => ''new'' 9 end I can''t seem to properly spec this out. I am trying numerous things, the latest one is
2011 Jun 12
2
when new rails releases.......
What do you do? A new release can break an application build on a preceding release and often an application needs to modify. So what to do? Fix the rails version in the Gemfile? In this manner I''ll have a lot of rails versions in the disk. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send