Created
March 5, 2013 16:15
-
-
Save leikind/5091456 to your computer and use it in GitHub Desktop.
This file contains 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
#Standard library | |
File.open(path, "w") do |file| | |
file_data = file.read | |
end | |
Benchmark.bm do |x| | |
x.report { for i in 1..n; a = "1"; end } | |
x.report { n.times do ; a = "1"; end } | |
x.report { 1.upto(n) do ; a = "1"; end } | |
end | |
# Sinatra | |
get "/hello" do | |
Time.now.strftime("Current time: %I:%M%p") | |
end | |
#Rails routes: | |
resources :docs do | |
resources :version_uploads | |
resource :property_downgrade, :module => "doc" | |
collection do | |
get 'uploaded' | |
end | |
end | |
# testing library | |
describe 'upgrade_to_document!' do | |
let!(:document_file){FactoryGirl.create(:image_file)} | |
it "changes the type from DocumentFile to Document" do | |
expect { | |
document_file.upgrade_to_document! | |
}.to change(document_file, :type).from('DocumentFile').to('Document') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment