kelredd-resourceful 0.6.6 → 0.6.7
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.
@@ -41,7 +41,9 @@ module Resourceful
|
|
41
41
|
|
42
42
|
def attribute(config)
|
43
43
|
begin
|
44
|
-
get_node(config[:path])
|
44
|
+
node = get_node(config[:path])
|
45
|
+
node = node.first if node.respond_to?('first')
|
46
|
+
node.send((config[:content] || 'content').to_s)
|
45
47
|
rescue Exception => err
|
46
48
|
nil
|
47
49
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Resourceful
|
2
|
+
module Shoulda
|
3
|
+
module TestUnit
|
4
|
+
|
5
|
+
def should_have_resourceful_attribute(name, opts={})
|
6
|
+
clean_name = name.to_s.gsub(/\W/, '')
|
7
|
+
should_have_instance_methods clean_name, "#{clean_name}=", "_#{clean_name}"
|
8
|
+
# TODO: Validate this attribute is of type opts[:type] if provided
|
9
|
+
end unless Test::Unit::TestCase.method_defined? :should_have_resourceful_attribute
|
10
|
+
|
11
|
+
# Ripped from Shoulda::ActiveRecord::Macros
|
12
|
+
def should_have_instance_methods(*methods)
|
13
|
+
get_options!(methods)
|
14
|
+
klass = described_type
|
15
|
+
methods.each do |method|
|
16
|
+
should "respond to instance method ##{method}" do
|
17
|
+
assert_respond_to klass.new, method, "#{klass.name} does not have instance method #{method}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end unless Test::Unit::TestCase.method_defined? :should_have_instance_methods
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Test::Unit::TestCase.extend(Resourceful::Shoulda::TestUnit) if defined? Test::Unit::TestCase
|
data/lib/resourceful/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kelredd-resourceful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -103,10 +103,14 @@ files:
|
|
103
103
|
- lib/resourceful/resource/cache.rb
|
104
104
|
- lib/resourceful/resource/format.rb
|
105
105
|
- lib/resourceful/resource.rb
|
106
|
+
- lib/resourceful/shoulda
|
107
|
+
- lib/resourceful/shoulda/test_unit.rb
|
108
|
+
- lib/resourceful/shoulda.rb
|
106
109
|
- lib/resourceful/version.rb
|
107
110
|
- lib/resourceful.rb
|
108
111
|
has_rdoc: false
|
109
112
|
homepage: ""
|
113
|
+
licenses:
|
110
114
|
post_install_message:
|
111
115
|
rdoc_options:
|
112
116
|
- --main
|
@@ -128,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
132
|
requirements: []
|
129
133
|
|
130
134
|
rubyforge_project:
|
131
|
-
rubygems_version: 1.
|
135
|
+
rubygems_version: 1.3.5
|
132
136
|
signing_key:
|
133
137
|
specification_version: 3
|
134
138
|
summary: A ruby gem to abstract web resource handling.
|