la_maquina 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -7
- data/lib/la_maquina/dependency_map/constant_map.rb +1 -1
- data/lib/la_maquina/piston/sunspot_piston.rb +1 -1
- data/lib/la_maquina/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/unit/dependency_maps/constant_map_test.rb +30 -0
- data/test/unit/dependency_maps/yamp_map_test.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 882d374d14ea85b1f5fc6cecbe12fd5756fdb35d
|
|
4
|
+
data.tar.gz: 9f0237300142961bd25cc6ff24e4524df633d62b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8a1e57d81fcaa1b20b398ee2b798b898030afb2a1517b70bfb55b914c6b750c03262e423ff9ac545f28d0eefc4a45d6a54dfab6ea92c3f1c23fae2c1bf67cf53
|
|
7
|
+
data.tar.gz: 2c77272adacb71c9253069904f279e52505554a8350875c1d35364b28db60ff2216899d36942ef88bb9bc255394ef2bd9e6a47a0dbce575f7b3cedaa74a4b3a8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -196,14 +196,12 @@ map.mapping_for "danny_trejo", "machete", 1 # => "favorite"
|
|
|
196
196
|
```
|
|
197
197
|
|
|
198
198
|
### ErrorNotifier
|
|
199
|
-
LaMaquina by default comes with an `ErrorNotifier::Base` that will explode in a very unhelpful manner. To override it, you need to change it in the config above and roll a new `ErrorNotifier` that responds to `notify(error, details)`. For example,
|
|
199
|
+
LaMaquina by default comes with an `ErrorNotifier::Base` that will explode in a very unhelpful manner. To override it, you need to change it in the config above and roll a new `ErrorNotifier` that responds to `notify(error, details)`. For example, a really handy debugging notifier you can build is a PutsNotifier, that just puts the error details, and looks like this:
|
|
200
200
|
```ruby
|
|
201
|
-
class
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
:parameters => details
|
|
206
|
-
)
|
|
201
|
+
class PutsNotifier < LaMaquina::ErrorNotifier::Base
|
|
202
|
+
|
|
203
|
+
def self.notify(error, details)
|
|
204
|
+
puts error.inspect, details.inspect
|
|
207
205
|
end
|
|
208
206
|
end
|
|
209
207
|
```
|
data/lib/la_maquina/version.rb
CHANGED
data/test/dummy/db/test.sqlite3
CHANGED
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ConstantMapTest < ActiveSupport::TestCase
|
|
5
|
+
def setup
|
|
6
|
+
@admin = admins(:wheel)
|
|
7
|
+
@map = LaMaquina::DependencyMap::ConstantMap.new
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def test_can_load_map
|
|
11
|
+
assert Admin, @map.mapping_for(:admin)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_catches_mapless_lookup
|
|
15
|
+
@map.mapping_for :lol
|
|
16
|
+
|
|
17
|
+
assert_equal NoMethodError, $error.class
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_is_with_indifferent_access
|
|
21
|
+
assert Admin, @map.mapping_for("admin")
|
|
22
|
+
assert Admin, @map.mapping_for(:admin)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_can_go_to_any_depth
|
|
26
|
+
map = LaMaquina::DependencyMap::YamlMap.new( Rails.root + 'config/la_maquina/dependency_maps/deep_map.yml' )
|
|
27
|
+
assert_equal "trait", map.mapping_for( "admin", "trait" )
|
|
28
|
+
assert_equal "b", map.mapping_for( "guest", "trait", 1 )
|
|
29
|
+
end
|
|
30
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: la_maquina
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Greg Orlov
|
|
@@ -145,6 +145,7 @@ files:
|
|
|
145
145
|
- test/dummy/test/fixtures/standalones.yml
|
|
146
146
|
- test/dummy/test/fixtures/traits.yml
|
|
147
147
|
- test/test_helper.rb
|
|
148
|
+
- test/unit/dependency_maps/constant_map_test.rb
|
|
148
149
|
- test/unit/dependency_maps/yamp_map_test.rb
|
|
149
150
|
- test/unit/engine_test.rb
|
|
150
151
|
- test/unit/error_notifier_test.rb
|
|
@@ -239,6 +240,7 @@ test_files:
|
|
|
239
240
|
- test/dummy/test/fixtures/standalones.yml
|
|
240
241
|
- test/dummy/test/fixtures/traits.yml
|
|
241
242
|
- test/test_helper.rb
|
|
243
|
+
- test/unit/dependency_maps/constant_map_test.rb
|
|
242
244
|
- test/unit/dependency_maps/yamp_map_test.rb
|
|
243
245
|
- test/unit/engine_test.rb
|
|
244
246
|
- test/unit/error_notifier_test.rb
|