spec/rivendell/import/cut_spec.rb in rivendell-import-0.7 vs spec/rivendell/import/cut_spec.rb in rivendell-import-0.8
- old
+ new
@@ -12,10 +12,30 @@
Rivendell::Import::Cut.new(cart).cart.should == cart
end
end
+ describe "#to_json" do
+
+ let(:json_clone) do
+ Rivendell::Import::Cut.new(cart).tap do |clone|
+ clone.from_json subject.to_json, false
+ end
+ end
+
+ it "should support datetime (Time range)" do
+ subject.datetime = Time.parse("2014-03-20 00:00")..Time.parse("2014-03-21 23:59:59")
+ json_clone.datetime.should == subject.datetime
+ end
+
+ it "should support datepart (String range)" do
+ subject.daypart = "08:00:00".."12:00:00"
+ json_clone.daypart.should == subject.daypart
+ end
+
+ end
+
describe "#create" do
before(:each) do
subject.stub :xport => mock
end
@@ -37,9 +57,10 @@
describe "#update" do
before do
subject.number = 1
+ subject.cart.number = 1
end
context "when DB attributes are defined" do
let(:db_cut) do