parsing-utils 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/parsing_utils.rb +18 -0
- data/parsing-utils.gemspec +1 -1
- data/spec/parsing_utils_spec.rb +18 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/lib/parsing_utils.rb
CHANGED
@@ -51,5 +51,23 @@ module ParsingUtils
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
|
56
|
+
class IdentityParser
|
57
|
+
class << self
|
58
|
+
attr_accessor :supported_mime_types
|
59
|
+
def dependencies
|
60
|
+
end
|
61
|
+
def default_mime_type
|
62
|
+
'text/plain'
|
63
|
+
end
|
64
|
+
def dump(object, options = {})
|
65
|
+
object
|
66
|
+
end
|
67
|
+
def load(object, options = {})
|
68
|
+
object
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
54
72
|
|
55
73
|
end
|
data/parsing-utils.gemspec
CHANGED
data/spec/parsing_utils_spec.rb
CHANGED
@@ -29,4 +29,22 @@ describe ParsingUtils do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
describe ParsingUtils::IdentityParser do
|
33
|
+
it "should behave like a parser" do
|
34
|
+
ParsingUtils::IdentityParser.default_mime_type.should == 'text/plain'
|
35
|
+
ParsingUtils::IdentityParser.should respond_to(:dump)
|
36
|
+
ParsingUtils::IdentityParser.should respond_to(:load)
|
37
|
+
ParsingUtils::IdentityParser.should respond_to(:dependencies)
|
38
|
+
ParsingUtils::IdentityParser.should respond_to(:supported_mime_types)
|
39
|
+
ParsingUtils::IdentityParser.should respond_to(:supported_mime_types=)
|
40
|
+
end
|
41
|
+
it "behave such as the dumped object be the same as original object" do
|
42
|
+
object = mock("object")
|
43
|
+
ParsingUtils::IdentityParser.dump(object).should == object
|
44
|
+
end
|
45
|
+
it "behave such as the loaded object be the same as original object" do
|
46
|
+
object = mock("object")
|
47
|
+
ParsingUtils::IdentityParser.load(object).should == object
|
48
|
+
end
|
49
|
+
end
|
32
50
|
end
|