-
-
Save KensoDev/3919455 to your computer and use it in GitHub Desktop.
rspec
This file contains 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
def new | |
slug = Slug.where(name: params[:slug_text]).first | |
return redirect_to :root unless slug | |
@place = slug.sluggable | |
return redirect_to :root unless @place | |
end |
This file contains 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 ModerationController do | |
describe "#new" do | |
it "sends the query to the correct class" do | |
place=stub(:place) | |
Slug.should_receive(:where).with(name: "Paris").and_return(place) | |
get :new, slug_text: "Paris" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment