spec/recurator_spec.rb in recurator-0.0.1 vs spec/recurator_spec.rb in recurator-0.0.2
- old
+ new
@@ -5,20 +5,24 @@
Recurator.new({
"one" => {
"two" => {
"three" => 3
}
- }
+ }
})
end
it "initialize" do
- Recurator.new({})
+ expect(Recurator.new([])).to be_a_instance_of(Recurator)
+ expect(Recurator.new({})).to be_a_instance_of(Recurator)
+ expect([].to_recur).to be_a_instance_of(Recurator)
+ expect({}.to_recur).to be_a_instance_of(Recurator)
end
it "include Enumerable" do
- Recurator.include?(Enumerable)
+ expect(Recurator).to include(Enumerable)
+ expect(Recurator.new({}).to_enum).to be_a_instance_of(Enumerator)
end
it "each" do
ret = []
recur.each {|o|
@@ -27,7 +31,11 @@
expect(ret).to eq([["one",{"two"=>{"three"=>3}}], ["two",{"three"=>3}], ["three",3]])
end
it "keys" do
expect(recur.keys).to eq(["one","two","three"])
+ end
+
+ it "values" do
+ expect(recur.values).to eq([{"two"=>{"three"=>3}}, {"three"=>3}, 3])
end
end