#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