Skip to content

Instantly share code, notes, and snippets.

@dgwmfo
Created December 6, 2010 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgwmfo/730345 to your computer and use it in GitHub Desktop.
Save dgwmfo/730345 to your computer and use it in GitHub Desktop.
Testimonials model
# == Schema Information
# Schema version: 20101204132114
#
# Table name: testimonials
#
# id :integer(4) not null, primary key
# content :string(255)
# user_id :integer(4)
# author_type :integer(4)
# enabled :boolean(1)
# created_at :datetime
# updated_at :datetime
#
class Testimonial < ActiveRecord::Base
attr_accessible :content, :author_type, :enabled
belongs_to :user
validates_presence_of :content, :user_id, :author_type, :enabled
validates_length_of :content, :maximum => 250
end
class Admin::TestimonialsController < Admin::BaseController
def show
@testimonial = Testimonial.find(params[:id])
end
def new
@page_title = "Create New Testimonial"
end
def edit
end
def index
end
end
require 'spec_helper'
describe Admin::TestimonialsController do
integrate_views
describe "GET 'new'" do
it "should be successful" do
get 'new'
response.should be_success
end
it "should have the right title" do
get 'testimonials/new'
response.should have_tag("title", /Create New Testimonial/)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment