obsidian 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,12 +2,15 @@ History.txt
2
2
  LICENSE
3
3
  Manifest.txt
4
4
  README.rdoc
5
+ README.txt
5
6
  Rakefile
6
7
  lib/obsidian.rb
8
+ lib/obsidian/rails/helper_test.rb
7
9
  lib/obsidian/rails/model_update_tracker.rb
8
10
  lib/obsidian/spec.rb
9
11
  lib/obsidian/spec/map_spec_helper.rb
10
12
  lib/obsidian/spec/set_spec_helper.rb
13
+ obsidian.gemspec
11
14
  test/obsidian_test.rb
12
15
  test/test_helper.rb
13
16
  test/units/obsidian/rails/model_update_tracker_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.
@@ -1,3 +1,3 @@
1
1
  module Obsidian
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -0,0 +1,22 @@
1
+ require 'test/unit'
2
+
3
+ module Obsidian::Rails
4
+ module HelperTest
5
+ # include all the fun dependancies needed to test helpers
6
+ def helper_test helper_under_test = nil
7
+ include ActionView::Helpers::CaptureHelper
8
+ include ActionView::Helpers::DateHelper
9
+ include ActionView::Helpers::UrlHelper
10
+ include ActionView::Helpers::TextHelper
11
+ include ActionView::Helpers::AssetTagHelper
12
+ include ActionView::Helpers::TagHelper
13
+ include ActionView::Helpers::FormOptionsHelper
14
+ include ActionView::Helpers::FormTagHelper
15
+ include ApplicationHelper
16
+ include helper_under_test if helper_under_test
17
+ end
18
+
19
+ end
20
+ end
21
+
22
+ Test::Unit::TestCase.extend Obsidian::Rails::HelperTest
@@ -0,0 +1,34 @@
1
+ (in /Users/rsanheim/src/relevance/runcoderun/vendor/gems/obsidian-0.0.4)
2
+ Gem::Specification.new do |s|
3
+ s.name = %q{obsidian}
4
+ s.version = "0.0.4"
5
+
6
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
7
+ s.authors = ["Relevance"]
8
+ s.date = %q{2008-07-09}
9
+ s.description = %q{It's metastable}
10
+ s.email = %q{opensource@thinkrelevance.com}
11
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
12
+ s.files = ["History.txt", "LICENSE", "Manifest.txt", "README.rdoc", "README.txt", "Rakefile", "lib/obsidian.rb", "lib/obsidian/rails/helper_test.rb", "lib/obsidian/rails/model_update_tracker.rb", "lib/obsidian/spec.rb", "lib/obsidian/spec/map_spec_helper.rb", "lib/obsidian/spec/set_spec_helper.rb", "test/obsidian_test.rb", "test/test_helper.rb", "test/units/obsidian/rails/model_update_tracker_test.rb", "test/units/obsidian/spec/map_spec_helper_test.rb", "test/units/obsidian/spec/set_spec_helper_test.rb", "test/units/obsidian/spec_test.rb"]
13
+ s.has_rdoc = true
14
+ s.homepage = %q{http://opensource.thinkrelevance.com}
15
+ s.rdoc_options = ["--main", "README.txt"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{thinkrelevance}
18
+ s.rubygems_version = %q{1.2.0}
19
+ s.summary = %q{It's metastable}
20
+ s.test_files = ["test/test_helper.rb"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if current_version >= 3 then
27
+ s.add_development_dependency(%q<hoe>, [">= 1.7.0"])
28
+ else
29
+ s.add_dependency(%q<hoe>, [">= 1.7.0"])
30
+ end
31
+ else
32
+ s.add_dependency(%q<hoe>, [">= 1.7.0"])
33
+ end
34
+ 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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Relevance
@@ -9,17 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-11 00:00:00 -04:00
12
+ date: 2008-07-09 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hoe
17
+ type: :development
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
21
  - - ">="
21
22
  - !ruby/object:Gem::Version
22
- version: 1.5.1
23
+ version: 1.7.0
23
24
  version:
24
25
  description: It's metastable
25
26
  email: opensource@thinkrelevance.com
@@ -30,17 +31,21 @@ extensions: []
30
31
  extra_rdoc_files:
31
32
  - History.txt
32
33
  - Manifest.txt
34
+ - README.txt
33
35
  files:
34
36
  - History.txt
35
37
  - LICENSE
36
38
  - Manifest.txt
37
39
  - README.rdoc
40
+ - README.txt
38
41
  - Rakefile
39
42
  - lib/obsidian.rb
43
+ - lib/obsidian/rails/helper_test.rb
40
44
  - lib/obsidian/rails/model_update_tracker.rb
41
45
  - lib/obsidian/spec.rb
42
46
  - lib/obsidian/spec/map_spec_helper.rb
43
47
  - lib/obsidian/spec/set_spec_helper.rb
48
+ - obsidian.gemspec
44
49
  - test/obsidian_test.rb
45
50
  - test/test_helper.rb
46
51
  - test/units/obsidian/rails/model_update_tracker_test.rb
@@ -70,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
75
  requirements: []
71
76
 
72
77
  rubyforge_project: thinkrelevance
73
- rubygems_version: 1.1.1
78
+ rubygems_version: 1.2.0
74
79
  signing_key:
75
80
  specification_version: 2
76
81
  summary: It's metastable