spec/latinum/resource_spec.rb in latinum-0.5.3 vs spec/latinum/resource_spec.rb in latinum-0.5.4
- old
+ new
@@ -20,15 +20,10 @@
require 'latinum/resource'
module Latinum::ResourceSpec
describe Latinum::Resource do
- before(:all) do
- @bank = Latinum::Bank.new
- @bank.import(Latinum::Currencies::Global)
- end
-
it "should load and dump resources" do
resource = Latinum::Resource.load("10 NZD")
string_representation = Latinum::Resource.dump(resource)
loaded_resource = Latinum::Resource.load(string_representation)
@@ -37,9 +32,16 @@
end
it "should load and dump nil correctly" do
expect(Latinum::Resource.load(nil)).to be nil
expect(Latinum::Resource.dump(nil)).to be nil
+ end
+
+ it "should load and dump resources correctly" do
+ resource = Latinum::Resource.new(10, 'NZD')
+
+ expect(Latinum::Resource.load("10.0 NZD")).to be == resource
+ expect(Latinum::Resource.dump(resource)).to be == "10.0 NZD"
end
it "should inspect nicely" do
resource = Latinum::Resource.load("10 NZD")