Created
October 19, 2012 17:02
-
-
Save gohuygo/3919350 to your computer and use it in GitHub Desktop.
rspec
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
| def new | |
| begin | |
| @slug = params[:slug_text] | |
| @place = Slug.where(name: @slug).first.sluggable | |
| @klass = @place.class | |
| rescue Exception => e | |
| redirect_to :root | |
| end | |
| end |
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 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