Skip to content

Instantly share code, notes, and snippets.

@foca
Created August 4, 2008 22:52
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 foca/3989 to your computer and use it in GitHub Desktop.
Save foca/3989 to your computer and use it in GitHub Desktop.
describe Celebrity do
it_should_behave_like "A featured model"
def sample_featurable_object
create_celebrity
end
end
describe Organization do
it_should_behave_like "A featured model"
def sample_featurable_object
create_organization
end
end
describe "A featured model", :shared => true do
# notar que nunca defino "sample_featurable_object" aca adentro
def featured
@featured ||= sample_featurable_object
end
def feature
@feature ||= Feature.create!(:featured => featured)
end
it "should raise when destroying a featured item" do
lambda { featured.destroy }.should raise(ActiveRecord::SomeError)
end
it "...?" do
# other specs
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment