Created
December 6, 2010 14:24
-
-
Save dgwmfo/730345 to your computer and use it in GitHub Desktop.
Testimonials model
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
# == 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 |
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
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 |
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
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