obsidian 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,6 @@
1
+ 2008-04-11
2
+ * Updated documentation in README
3
+
1
4
  2008-03-28
2
5
  * Added model_update_tracker
3
6
  * Added example rails applicaion in branch example
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2008 Relevance, Inc.
2
+
3
+ (The MIT License)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,6 +1,7 @@
1
1
  History.txt
2
+ LICENSE
2
3
  Manifest.txt
3
- README.txt
4
+ README.rdoc
4
5
  Rakefile
5
6
  lib/obsidian.rb
6
7
  lib/obsidian/rails/model_update_tracker.rb
@@ -10,6 +11,6 @@ lib/obsidian/spec/set_spec_helper.rb
10
11
  test/obsidian_test.rb
11
12
  test/test_helper.rb
12
13
  test/units/obsidian/rails/model_update_tracker_test.rb
13
- test/units/obsidian/spec_test.rb
14
14
  test/units/obsidian/spec/map_spec_helper_test.rb
15
15
  test/units/obsidian/spec/set_spec_helper_test.rb
16
+ test/units/obsidian/spec_test.rb
@@ -0,0 +1,96 @@
1
+ = Obsidian
2
+
3
+ == DESCRIPTION
4
+
5
+ Obsidian. It's metastable.
6
+
7
+ In the tangible world, obsidian is a naturally-occurring glass that is metastable at the earth's
8
+ surface. It's commonly found within the margins of rhyolitic lava flows, where cooling of the lava is
9
+ rapid. [1] In the slightly less tangible world of programming, <b>Obsidian</b> is home to chunks of
10
+ Ruby code that we've found helpful. These bits of code are often found at the bottom of a mountain of
11
+ yak hair, the occasionally-occurring product of simplifying various tasks.
12
+
13
+ 1 http://en.wikipedia.org/wiki/Obsidian
14
+
15
+ == FEATURES
16
+
17
+ === Model Update Tracker
18
+ This library allows you to functionally test updates to models with clearer and more focused intent.
19
+ It forces you to have a better understanding of how your objects interact and lets you demonstrate
20
+ that knowledge by specifying it in your tests. For example, consider the following test which asserts
21
+ that the code block persists an Asset record.
22
+
23
+ assert_difference Asset :count do
24
+ post :create, :asset => {}
25
+ end
26
+
27
+ Is it okay if the code block also persists a Location record? An AssetOwner record? Some other record?
28
+ Chances are that the developer knows the answer to this question, but the test fails to capture that
29
+ knowledge. Side effects matter, and our tests should adequately validate that the desired side effects
30
+ (and <i>only</i> the desired side effects) are taking place. In the example below, assert_models_created
31
+ allows us to validate that an Asset is created <i>and</i> that no other objects are inadvertently
32
+ persisted.
33
+
34
+ assert_models_created(Asset) do
35
+ post :create, :asset => {}
36
+ end
37
+
38
+ If the code block happened to create records other than just an Asset, a friendly test failure would let
39
+ you know right away.
40
+
41
+ Suppose, on the other hand, that you expect the creation of an Asset to <i>also</i> produce an AssetOwner
42
+ and a Location. This is where you exercise your deep domain knowledge muscles and make your new
43
+ Obsidian-powered test express and validate your intent.
44
+
45
+ assert_models_created(Asset, AssetOwner, Location) do
46
+ post: create, :asset => {}
47
+ end
48
+
49
+ Now, if your code block fails to create the expected records, the above test would fail stating that it
50
+ expected more to happen. If future changes to your code cause things to fall out of place, this test will
51
+ catch that regression where the original assert_difference may not. In addition to assert_models_created,
52
+ Model Update Tracker provides a whole host of other methods that provide similar functionality for
53
+ asserting behavior related to updates, deletes, or even validating that nothing happened.
54
+
55
+ * assert_models_created(models)
56
+ * assert_models_updated(models)
57
+ * assert_models_destroyed(models)
58
+ * assert_no_models_created
59
+ * assert_no_models_destroyed
60
+ * assert_no_models_updated
61
+
62
+ == INSTALL
63
+
64
+ sudo gem install obsidian
65
+
66
+ == URLS
67
+
68
+ * Log bugs, issues, and suggestions on Trac: http://opensource.thinkrelevance.com/wiki/obsidian
69
+ * View Source: http://github.com/relevance/obsidian/tree/master
70
+ * Git clone Source: git://github.com/relevance/obsidian.git
71
+ * RDocs: http://thinkrelevance.rubyforge.org/obsidian/
72
+
73
+ == LICENSE
74
+
75
+ (The MIT License)
76
+
77
+ Copyright (c) 2008 Relevance, Inc. - http://thinkrelevance.com
78
+
79
+ Permission is hereby granted, free of charge, to any person obtaining
80
+ a copy of this software and associated documentation files (the
81
+ 'Software'), to deal in the Software without restriction, including
82
+ without limitation the rights to use, copy, modify, merge, publish,
83
+ distribute, sublicense, and/or sell copies of the Software, and to
84
+ permit persons to whom the Software is furnished to do so, subject to
85
+ the following conditions:
86
+
87
+ The above copyright notice and this permission notice shall be
88
+ included in all copies or substantial portions of the Software.
89
+
90
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
91
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
92
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
93
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
94
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
95
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
96
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ require 'lib/obsidian'
8
8
  desc 'Default: run unit tests.'
9
9
  task :default => :test
10
10
 
11
- Hoe.new('obsidian', Obsidian::VERSION) do |p|
11
+ hoe = Hoe.new('obsidian', Obsidian::VERSION) do |p|
12
12
  p.rubyforge_name = "thinkrelevance"
13
13
  p.description = "It's metastable"
14
14
  p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
@@ -16,7 +16,23 @@ Hoe.new('obsidian', Obsidian::VERSION) do |p|
16
16
  p.summary = "It's metastable"
17
17
  p.author = "Relevance"
18
18
  p.email = "opensource@thinkrelevance.com"
19
- p.url = "http://opensource.thinkrelevance.com"
19
+ p.url = "http://opensource.thinkrelevance.com"
20
+ p.rdoc_pattern = /^(lib|bin|ext)|txt|rdoc$/
21
+ end
22
+
23
+ # Override RDoc to use allison template, and also use our .rdoc README as the main page instead of the default README.txt
24
+ Rake::RDocTask.new(:docs) do |rd|
25
+ gem "allison"
26
+ gem "markaby"
27
+ rd.main = "README.rdoc"
28
+ # rd.options << '-d' if RUBY_PLATFORM !~ /win32/ and `which dot` =~ /\/dot/ and not ENV['NODOT']
29
+ rd.rdoc_dir = 'doc'
30
+ files = hoe.spec.files.grep(hoe.rdoc_pattern)
31
+ files -= ['Manifest.txt']
32
+ rd.rdoc_files.push(*files)
33
+
34
+ title = "#{hoe.name}-#{hoe.version} Documentation"
35
+ title = "#{hoe.rubyforge_name}'s " + title if hoe.rubyforge_name != hoe.name
20
36
  end
21
37
 
22
38
  desc 'Test obsidian.'
@@ -1,3 +1,3 @@
1
1
  module Obsidian
2
- VERSION = '0.0.2'
3
- end
2
+ VERSION = '0.0.3'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obsidian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Relevance
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-07 00:00:00 -04:00
12
+ date: 2008-04-11 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,11 +30,11 @@ extensions: []
30
30
  extra_rdoc_files:
31
31
  - History.txt
32
32
  - Manifest.txt
33
- - README.txt
34
33
  files:
35
34
  - History.txt
35
+ - LICENSE
36
36
  - Manifest.txt
37
- - README.txt
37
+ - README.rdoc
38
38
  - Rakefile
39
39
  - lib/obsidian.rb
40
40
  - lib/obsidian/rails/model_update_tracker.rb
@@ -44,9 +44,9 @@ files:
44
44
  - test/obsidian_test.rb
45
45
  - test/test_helper.rb
46
46
  - test/units/obsidian/rails/model_update_tracker_test.rb
47
- - test/units/obsidian/spec_test.rb
48
47
  - test/units/obsidian/spec/map_spec_helper_test.rb
49
48
  - test/units/obsidian/spec/set_spec_helper_test.rb
49
+ - test/units/obsidian/spec_test.rb
50
50
  has_rdoc: true
51
51
  homepage: http://opensource.thinkrelevance.com
52
52
  post_install_message:
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  requirements: []
71
71
 
72
72
  rubyforge_project: thinkrelevance
73
- rubygems_version: 1.0.1
73
+ rubygems_version: 1.1.1
74
74
  signing_key:
75
75
  specification_version: 2
76
76
  summary: It's metastable
data/README.txt DELETED
@@ -1,76 +0,0 @@
1
- = Obsidian
2
-
3
- http://opensource.thinkrelevance.com
4
-
5
- == DESCRIPTION:
6
-
7
- Obsidian. It's metastable.
8
- Chunks of Ruby code we have found helpful.
9
-
10
- == FEATURES/PROBLEMS:
11
-
12
- === Model Update Tracker
13
- This library allows you to functionally test updates to models with clearer and more focused intent.
14
- It forces you to have a better understanding of how your Objects interact and let's you demonstrate
15
- that knowledge by putting it in your tests. For example instead of writing a test like so
16
-
17
- assert_difference Asset :count do
18
- post :create, :asset => {}
19
- end
20
-
21
- you would write your test like so
22
-
23
- assert_models_created(Asset) do
24
- post :create, :asset => {}
25
- end
26
-
27
- Now if an asset really created multiple other objects such as an asset owner and a location the above
28
- test would fail stating that it expected more to happen. This is where you excercise your deep domain
29
- knowledge muscles and make your new obsidian powered test pass.
30
-
31
- assert_models_saved(Asset, AssetOwner, Location) do
32
- post: create, :asset => {}
33
- end
34
-
35
- You have just done youself a great service. If for some reason you change code that affects your
36
- object model and things fall out of place this test will catch that regression error where the original
37
- assert_difference may not. There are also a whole host of other methods you can use with model update
38
- tracker that provide functionality for updates, deletes, and no_difference assertions.
39
-
40
- * assert_models_created(models)
41
- * assert_models_updated(models)
42
- * assert_models_destroyed(models)
43
- * assert_no_models_created
44
- * assert_no_models_destroyed
45
- * assert_no_models_updated
46
-
47
- == INSTALL:
48
-
49
- git clone git://github.com/relevance/obsidian.git
50
- rake gem
51
- sudo gem install pkg/#{pkg_name}
52
-
53
- == LICENSE:
54
-
55
- (The MIT License)
56
-
57
- Copyright (c) 2008 Relevance, Inc.
58
-
59
- Permission is hereby granted, free of charge, to any person obtaining
60
- a copy of this software and associated documentation files (the
61
- 'Software'), to deal in the Software without restriction, including
62
- without limitation the rights to use, copy, modify, merge, publish,
63
- distribute, sublicense, and/or sell copies of the Software, and to
64
- permit persons to whom the Software is furnished to do so, subject to
65
- the following conditions:
66
-
67
- The above copyright notice and this permission notice shall be
68
- included in all copies or substantial portions of the Software.
69
-
70
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
71
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
72
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
73
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
74
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
75
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
76
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.