similar to: problem setting expectation for test with delayed::job

Displaying 20 results from an estimated 100 matches similar to: "problem setting expectation for test with delayed::job"

2012 Feb 07
6
nested route not receiving :id parameter within controller spec
I''ve got a share method in my controller, and I have the following spec: describe PostsController do describe "#share" do it "doesn''t blow up" do post :share, :id => @post.id end # ... etc And... It blows up! Failures: 1) PostsController#share shares Failure/Error: post :share
2012 Feb 13
11
stale records with integration testing?
Hi, I was writing an integration test for my user signup form (with capybara), and found that my test was failing due to a validation error: "email is already taken". I''m a bit confused because I thought when I run "rspec spec/some_spec.rb", the test database would be wiped clear? Is that not the case? Patrick J. Collins http://collinatorstudios.com
2011 Jun 06
9
rake 0.9.0 activated error + debugger not working?
Hi everyone, I am using rvm, and when I try to do rake spec, I get: "You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7. Consider using bundle exec." ... Is there a way to get around this so I don''t have to do bundle exec rake spec each and every time? Also, I tried throwing ''debugger'' into one of my specs and I get:
2006 Apr 28
0
Minimum needed to observe a model
I have a model called Post and a observer called PostObserver. I also have in environment.rb file the line: config.active_record.observers = :post_observer I read that observers default to the model with the same name, but the model class isn''t being observed. Observe works if I put in the ForumController: observer :post_observer But this doesn''t seem right. Jose --
2008 Feb 04
1
Error on nil.build
I can''t figure out why I am getting an error for one of the tests below: ======================== describe AccountsController, "POST" do before :each do @user = mock_model(User) @account = mock_model(Account, :id => 1, :valid => true, :save => true, :users => mock("users", :build => @user)) Account.should_receive(:new).and_return(@account)
2007 Jul 12
3
Agh, this is annoying. Why is this happening?
My problem: Mock ''Task_1005'' received unexpected message :user_id= with (1) No matter what I do to try to stub that out it will still fail out and give me that message. Here is my spec describe TasksController, "handling POST /tasks" do before(:each) do @task = mock_model(Task, :to_param => "1", :save => true)
2008 Apr 23
0
How i write the respec in this situation??
Hi all guys!im new in rails! i have a forum,have_many topics,and the topic also has_many replies.Now i want to write the respec for the repliescontroller: describe RepliesController do controller_name :repies describe "All Requests",:share=>true do before do @forum = mock_model(Forum,:id=>''1'') @topic =
2007 Aug 21
2
using restful_authentication current_user inside controller specs
I''m using restful_authentication in my app and I have the before filters in my application rhtml: before_filter :login_required around_filter :set_timezone around_filter :catch_errors Currently I have them commented out while rspec''in but I''ll need to add them in my specs. def create @ticket = Ticket.new(params[:ticket]) @ticket.user = current_user if
2007 Aug 17
11
[rspec] looking for a simple refresher
I''ve been off the rspec for a few months and I''m trying to get back on it. 1) Spec::Mocks::MockExpectationError in ''TicketsController handling POST /tickets should create a new ticket'' Mock ''Ticket_1001'' expected :new with ({}) once, but received it 0 times ./spec/controllers/tickets_controller_spec.rb:16: script/spec:4: class
2007 Jan 30
5
errors while testing resource controller using rpec
I am testing a resource called venue in this piece of code (generated using script/rspec_resource) ==================== context "Requesting /venues using POST" do controller_name :venues setup do @mock_venue = mock(''Venue'') @mock_venue.stub!(:save).and_return(true) @mock_venue.stub!(:to_param).and_return(1) Venue.stub!(:new).and_return(@mock_venue)
2006 Apr 29
11
Multiple actions from one form - possible?
Hello * Obviously the rhtml below does not work, but it should be apparent what I try to achieve - I would like to give the user the choice to submit a form either to action1 or action2 but I cannot figure out how?! It would be great if someone could give some assistance. Thanks a lot, Alex <%= start_form_tag :action1 => ''save'', :action2 =>
2007 Jan 08
2
thoughts on mocks and specs
I spent the last couple of days getting my sea legs with Rails and RSpec. I''d been waiting til things seemed calmer before jumping in, and I''m overall very happy with my experience so far. My only real annoyance so far has been forgetting to call "do_post" or "do_create" from my specify blocks. My mocks don''t get the calls they want, and it usually
2006 Apr 21
3
rjs in multiple ajax page
Sorry for the long explanation but I''m having trouble integrating rjs into my form page. Here''s my page: <div id="posts"> <ul id="post_list"><%= render :partial => ''list_results'', :collection => @posts %></ul> <p><%= link_to_remote(''+'', :url => {:action =>
2012 Feb 21
8
should_receive_chain
Do you often find yourself doing this: active = double(''active'') active.should_receive(:first) users = double(''users'', active: active) account.should_receive(:users).and_return(users) for this: account.users.active.first ? Of course, we could use stub_chain, but that doesn''t let us know *where* the chain broke. Would you like to do this?
2005 Jan 19
1
Problem with ActiveRecordStore
I''m having an issue using the ActiveRecordStore for sessions with Rails 0.9.4.1. When I setup the session object during login I get the following stack trace: IndexError in Login#auth string not matched /app/controllers/login_controller.rb:26:in `auth'' gems/gems/actionpack-1.3.1/lib/action_controller/base.rb:596:in `send''
2007 Nov 08
0
Models for external REST services
Hello, I''m new to rails so as an exercise I''m porting (php to rails) a very simple landing page that talks with a third party REST service where I just need to do a couple of calls to register a user and show the status of the whole process. I felt this would be dead simple to do in Rails (I''m still learning) but I''m having a hard time getting it working. My
2007 Oct 26
2
Examples of writing controller specs that use authentication
Hello, I''m working on specs for a controller that handles authentication using the restful_authentication plugin. I''m trying to find a resource (tutorial or examples, if possible) about the best way to go about writing mocks and specs to make sure that things like my before_filters are working correctly. Does anyone know of any good resources for this? Thanks, Les
2007 Nov 21
6
How thorough do you test?
Testing models is great and would not be able to create anything without it, but I am finding testing the controllers and views is a pain. Rest based controllers don''t seem to change that much when compared to the auto-generated code that obviously works. As for views I fail to see why testing it with a mock model does anything. Nothing is ensuring that when changes are made to the
2007 Mar 29
10
Mongrel Service won''t start on windows
64bit Intel 8 CPU server Windows 2003 Server Service set to run as LocalSystem, doesn''t work as user account either The error we see is: "Service failed to start in a timely..." Which I have seen in the past email trails as working The app works from mongrel_rails start and from mongrel_service console -N servicename -p 3000 -c c:\rails_apps\appname -e production We upgraded
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