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
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb') | |
describe Templates, "index action" do | |
before :all do | |
create_template_xml 'simple', <<-"XML" | |
<template name="simple" description="The simplest template possible" /> | |
XML | |
end | |
before do |
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
You can specify how many times you want to run the benchmarks with rake:perf x=(number) | |
Some tasks will be run 10 and 1000 times less than (number) | |
Benchmarks will now run 10000 times | |
| DM 0.9.4 | AR 2.1 | DIFF | | |
-------------------------------------------------------------------------------- | |
Model.get specific (not cached) x10000 | 29.548 | 15.131 | 1.95x | | |
Model.get specific (cached) x10000 | 1.573 | 15.245 | 0.10x | | |
Model.first x10000 | 22.623 | 14.991 | 1.51x | | |
Model.all limit(100) x1000 | 28.172 | 31.094 | 0.91x | | |
Model.all limit(10,000) x10 | 26.626 | 33.923 | 0.78x | |
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
diff --git a/lib/dm-core/resource.rb b/lib/dm-core/resource.rb | |
index 225200d..8eb59bf 100644 | |
--- a/lib/dm-core/resource.rb | |
+++ b/lib/dm-core/resource.rb | |
@@ -40,6 +40,10 @@ module DataMapper | |
model.const_set('Resource', self) unless model.const_defined?('Resource') | |
extra_inclusions.each { |inclusion| model.send(:include, inclusion) } | |
descendants << model | |
+ class << model | |
+ @_valid_model = false |
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
Before Yehuda's commit ( e253765ed82aa91cc91555eb5871d82d5df3e436 ): | |
| DM 0.9.4 | AR 2.1 | DIFF | | |
-------------------------------------------------------------------------------- | |
Model.new (instantiation) x10000 | 0.949 | 0.568 | 1.67x | | |
Model.new(setting attributes) x10000 | 2.757 | 2.233 | 1.23x | | |
Before _monki's fix ( db6c116af073ad5cd219652366f2ef4fb47ef807 ): | |
| DM 0.9.4 | AR 2.1 | DIFF | |
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
{ | |
:_type => Template, | |
:id => template.path, | |
:href => uri(:controller => :templates, :action => template.path), | |
:name => template.name, | |
:description => template.description, | |
:max_associations_per_configuration => template.max_associations_per_configuration, | |
:questions_href => questions_url(template), | |
:restricted_platforms => template.restricted_platforms, | |
:restricted_clients => template.restricted_clients |
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
{ | |
"href": "http://config.ssbe.localhost/templates", | |
"item_count": 1, | |
"items": [ | |
{ | |
"id": "os/linux/linux-core", | |
"href": "http://config.ssbe.localhost/templates/os/linux/linux-core", | |
"name": "Linux Core", | |
"description": "CPU and other general Linux metrics", | |
"max-associations-per-configuration": 1 |
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
require 'rubygems' | |
require 'uuidtools' | |
module DataMapper | |
module Types | |
class UUID < DataMapper::Type | |
default lambda { ::UUID.random_create } | |
def self.load(value, property) | |
puts value.inspect |
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
describe 'creating a article by web services' do | |
before do | |
@result = post('/articles', '{ "title": "My Article", "text": "Lorem Ipsum" }', :content_type => 'application/json') | |
@article_uri = @result.header['Location'] | |
id = parse_route(@article_uri)[:id] | |
@article = Article.get(id) | |
end | |
it 'should be successful' do |