Displaying 4 results from an estimated 4 matches for "items_controller_spec".
2007 Jan 05
2
Using RESTful routes in controller tests
...;'m getting the following error:
NoMethodError in ''POST on /lists/2/items should redirect to index on
succesful POST''
You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.rewrite
(eval):19:in `list_path''
./spec/controllers/items_controller_spec.rb:36:
Finished in 0.114317 seconds
Writing "controller.should_redirect_to :controller => ''lists'', :action
=> ''show'', :id => 2" works though.
Am I forgetting something?
2007 Sep 18
2
rSpec / Nested Routes / Mocks
...setup. Problem line indicated with ******
--routes.rb--
map.resources :users do |users|
users.resources :items
end
--items_controller--
def create
@item = Item.new(params[:item])
@item.user = User.find(params[:user_id])
respond_to do |format|
if @item.save
....etc.....
--items_controller_spec--
describe ItemsController, "create action" do
before do
@item = mock_model(Item, :to_param => "1")
@user = mock_model(User, :to_param => "1")
Item.stub!(:new).and_return(@course)
User.stub!(:find).and_return(@user)
end
def post_with_success...
2007 Oct 26
3
Specing with Subdomains as Account Keys
...Any ideas?
(This question was originally posted under "Mocking/Stubbing help
with subdomain as account key"
- http://rubyforge.org/pipermail/rspec-users/2007-October/
004138.html, but I''ve rephrased it to make it more clear with the
subdomain as account key question.)
# items_controller_spec.rb
describe ItemsController, "handling GET /items" do
fixtures :companies
before do
@request.host = "subdomain.test.host"
@item = mock(Item)
Item.stub!(:find).and_return([@item])
@current_company = mock(Company)
@current_company.stub!(:items).and_...
2006 Aug 24
0
"rake spec" doesn''t work after upgrade to 0.6.1
.../1.8/gems/rspec-0.6.1/lib/spec.rb:1
from /usr/lib/ruby/gems/1.8/gems/rspec-0.6.1/bin/spec:2
/usr/bin/ruby1.8 -Ilib
/usr/lib/ruby/gems/1.8/gems/rspec-0.6.1/bin/spec
"spec/controllers/media_controller_spec.rb"
"spec/controllers/media_listing_worker_spec.rb"
"spec/controllers/items_controller_spec.rb"
/usr/lib/ruby/gems/1.8/gems/rspec-0.6.1/lib/spec.rb:1:in `require'': no
such file to load -- spec/version (LoadError)
from /usr/lib/ruby/gems/1.8/gems/rspec-0.6.1/lib/spec.rb:1
from /usr/lib/ruby/gems/1.8/gems/rspec-0.6.1/bin/spec:2
rake aborted!
RSpec failures
Thoughts?
jh...