Browse files

Fixed failing tests. Added couple pending test placeholders.

  • Loading branch information...
1 parent b1bf288 commit 8280fbcf0b0670703c46f0f5b8fd929acbbfc161 @basti basti committed Mar 11, 2011
View
4 spec/controllers/items_controller_spec.rb
@@ -18,7 +18,7 @@ def mock_item(stubs={})
describe "GET index" do
it "assigns only owner's items as @items" do
signedin_user.stub(:person).and_return(mock_model(Person))
- signedin_user.person.stub(:items) { [mock_item] }
+ signedin_user.person.stub_chain(:items, :without_deleted) { [mock_item] }
get :index
assigns(:items).should eq([mock_item])
end
@@ -174,7 +174,7 @@ def mock_item(stubs={})
describe "DELETE destroy" do
it "destroys the requested item" do
Item.stub(:find).with("37") { mock_item }
- mock_item.should_receive(:destroy)
+ mock_item.should_receive(:delete)
delete :destroy, :id => "37"
end
View
4 spec/controllers/people_controller_spec.rb
@@ -16,7 +16,7 @@
describe "GET show" do
before do
- mock_person.stub(:items).and_return(mock_items)
+ mock_person.stub_chain(:items, :without_deleted).and_return(mock_items)
mock_person.stub(:unanswered_requests).and_return(mock_item_requests)
Person.stub(:find).with("37") { mock_person }
get :show, :id => "37"
@@ -31,7 +31,7 @@
end
it "should assign person's items as @items" do
- assigns(:items).should == mock_person.items
+ assigns(:items).should == mock_person.items.without_deleted
end
it "should assign person's unanswered requests as @unanswered_requests" do
View
6 spec/models/item_spec.rb
@@ -36,4 +36,10 @@
# apparently when should validate_attachment_size is run under Ruby 1.8.7 it hangs
# (it should work correctly under Ruby 1.9.2+). For now we'll just comment it out.
# it { should validate_attachment_size(:photo).less_than(1.megabyte) }
+
+ pending "should respond do deleted?" # test deleted? method
+ pending "should be soft-deleted (delete)" # test delete method
+ pending "should be able to get restored" # test restore method
+
+
end
View
4 spec/views/pages/dashboard.html.erb_spec.rb
@@ -78,15 +78,15 @@
# rendered.should match(/#{first_request.gifter.avatar}/)
rendered.should contain(/#{first_request.gifter.name}/)
rendered.should have_selector("a#request_#{first_request.id}", :href => request_path(first_request))
- rendered.should contain(/#{first_request.item.name}/)
+ rendered.should contain(/#{first_request.item.item_type}/)
rendered.should have_selector("a", :href => item_path(first_request.item))
# second request
rendered.should have_selector("a", :href => person_path(second_request.requester))
rendered.should match(/#{second_request.requester.avatar}/)
rendered.should contain(/#{second_request.requester.name}/)
rendered.should have_selector("a#request_#{second_request.id}", :href => request_path(second_request))
- rendered.should contain(/#{second_request.item.name}/)
+ rendered.should contain(/#{second_request.item.item_type}/)
rendered.should have_selector("a", :href => item_path(second_request.item))
end

0 comments on commit 8280fbc

Please sign in to comment.