Created
August 4, 2008 22:52
-
-
Save foca/3989 to your computer and use it in GitHub Desktop.
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
describe Celebrity do | |
it_should_behave_like "A featured model" | |
def sample_featurable_object | |
create_celebrity | |
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
describe Organization do | |
it_should_behave_like "A featured model" | |
def sample_featurable_object | |
create_organization | |
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
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