Skip to content

Instantly share code, notes, and snippets.

@arzumy
Created April 1, 2010 06:26
Show Gist options
  • Select an option

  • Save arzumy/351460 to your computer and use it in GitHub Desktop.

Select an option

Save arzumy/351460 to your computer and use it in GitHub Desktop.
#sample test for friendly_id for app with same name
require File.expand_path(File.dirname(__FILE__) + './../test_helper')
class AppsControllerTest < ActionController::TestCase
fast_context "GET to show" do
setup do
@app_one = Factory(:iphone_app, :name => "Tweetie")
@app_two = Factory(:iphone_app, :name => "Tweetie")
end
fast_context "first app" do
setup do
get :show, :id => "tweetie", :platform_id => @app_one.platform.to_param
end
should_assign_to(:app) { @app_one }
should_render_with_layout
should_render_template :show
should_respond_with :success
should_respond_with_content_type :html
should_not_set_the_flash
end
fast_context "second app" do
setup do
get :show, :id => "tweetie--2", :platform_id => @app_two.platform.to_param
end
should_assign_to(:app) { @app_two }
should_render_with_layout
should_render_template :show
should_respond_with :success
should_respond_with_content_type :html
should_not_set_the_flash
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment