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
| # Example of how to use multiple Routes in external files/modules | |
| require 'rubygems' | |
| require 'sinatra/base' | |
| # set the root of the whole app | |
| APP_ROOT = File.dirname(File.expand_path(__FILE__)) unless defined?(APP_ROOT) | |
| require "sinatra-external_routes_example" |
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
| ### NB!! This file is run within a directory and I've made it into a Git repo, so that each revision is saved. | |
| # Commented out for now. | |
| require "rubygems" | |
| %w(dm-core dm-validations dm-types dm-timestamps dm-is-list dm-is-tree dm-is-paginated).each {|lib| require lib } | |
| # DataMapper::Logger.new(STDERR, :debug) | |
| $dm_log_file = "#{File.dirname(__FILE__)}/dm.album.test.log" |
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
| # demo/app.rb | |
| # set the root of the whole app | |
| ::APP_ROOT = File.dirname(File.expand_path(__FILE__)) unless defined?(APP_ROOT) | |
| class MyApp < Sinatra::Base | |
| # snip set views etc | |
| set :environment, ENV["RACK_ENV"] ||= 'test' |
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
| ### NOTE!! Store this file in the | |
| # | |
| # github.com/datamapper/dm-more/tree/next # Next branch | |
| # | | |
| # |--> dm-is-list/spec/integration | |
| require 'pathname' | |
| require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' |
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
| ### ActiveRecord => ActsAsList vs DataMapper => dm-is-list | |
| # Scenario Setup: | |
| ## ActiveRecord: | |
| create_table :albums do |t| | |
| t.column :name, :string | |
| t.column :position, :integer | |
| t.column :parent_id, :integer, :default => 0 |
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 'pathname' | |
| require 'rubygems' | |
| gem 'rspec', '~>1.2' | |
| require 'spec' | |
| # gem 'data_objects', '0.9.12' | |
| gem('data_objects', '~>0.9') | |
| require 'data_objects' | |
| # gem 'do_sqlite3', '0.9.12' |
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 'rubygems' | |
| require 'spec' | |
| require 'spec/interop/test' | |
| # require 'test/spec' | |
| require 'sinatra/base' | |
| require 'rack/test' | |
| class Dummy < Sinatra::Base | |
| set :public, 'public' |
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
| ### QUESTION:: Why does this behave in this way ?? | |
| # | |
| # Summary: | |
| # | |
| # When adding a Sinatra Extension with instance variables that are essentially buffers during the request | |
| # the new values does NOT get added to the instance variable. | |
| # | |
| # Key Issues: | |
| # | |
| # * Compare using 'app' vs '@app' in the tests below. |
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
| # An example of how to use mounted apps and stil have acces to full paths within the apps. | |
| # | |
| # Created by Kematzy [ 2009-07-10 ] | |
| require 'rubygems' | |
| require 'sinatra/base' | |
| # set the root of the whole app | |
| APP_ROOT = File.dirname(File.expand_path(__FILE__)) unless defined?(APP_ROOT) |
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 MyApp < Sinatra::Base | |
| # .... | |
| # does nothing other than load the <input type="file"> form... | |
| get '/upload' do | |
| erb(:upload) | |
| end | |