-
-
Save davelnewton/5302416 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Dashboard::Buying::WatchedProductsController do | |
stub_user | |
let(:product) { mock('product', :id => 1) } | |
before { Product.stub(:find).with("1") { product } } | |
describe "#create" do | |
let(:responder) { Dashboard::Buying::WatchedProductsController::WatchListingResponder.new(subject) } | |
it "watches the listing" do | |
Reverb::Actions::WatchListing.should_receive(:watch).with(user, product, anything) | |
post :create, :id => product.id | |
response.should redirect_to product_url(product) | |
end | |
it "handles error display" do | |
responder.failure("foo") | |
flash[:error].should == "foo" | |
end | |
it "handles success display" do | |
responder.success | |
flash[:success].should =~ /Listing has been added to.*your watchlist.*/ | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment