Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Created January 6, 2009 19:10
Show Gist options
  • Save dchelimsky/43942 to your computer and use it in GitHub Desktop.
Save dchelimsky/43942 to your computer and use it in GitHub Desktop.
def should_assign_attachment_named(name)
it "should allow the assignment of #{name}" do
@attachment_model.__send__("#{name}=") = dummy_file
@attachment_model.should be_valid
@attachment_model.should have(:no).errors
end
it 'should save the #{name} when the model is saved' do
@attachment_model.__send__(name).should_receive(:save).once.and_return(true)
@attachment_model.save!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment