Sha256: 34b06805d3b98f00509193d61bb49875dda6363f4ab104bcac0ce3f88b7f9b3a
Contents?: true
Size: 1.56 KB
Versions: 11
Compression:
Stored size: 1.56 KB
Contents
require 'spec_helper' describe Trackman::Assets::Components::Diffable do class TestDiff extend Trackman::Assets::Components::Diffable end it "specify the html to update and the image to delete" do expected = { :create => [], :update => [Asset.create(:path => 'spec/test_data/sample.html')], :delete => [ Asset.create(:path => 'spec/test_data/test1.jpeg')] } remote = [ RemoteAsset.create(:path => 'spec/test_data/sample.html', :file_hash => 'abcd123'), RemoteAsset.create(:path => 'spec/test_data/test1.jpeg', :file_hash => '12345') ] local = [Asset.create(:path => 'spec/test_data/sample.html')] actual = TestDiff.diff local, remote actual.should eq(expected) end it "returns the file to create if it is missing remotely" do expected = { :create => [Asset.create(:path => 'spec/test_data/test1.jpeg')], :update => [], :delete => [] } html_asset = Asset.create(:path => 'spec/test_data/sample.html') remote = [html_asset] local = [html_asset, Asset.create(:path => 'spec/test_data/test1.jpeg')] actual = TestDiff.diff local, remote actual.should eq(expected) end it "can not mark html remotes as deleted" do expected = { :create => [], :update => [], :delete => [] } asset1 = RemoteAsset.create(:path => 'spec/test_data/sample.html') asset2 = RemoteAsset.create(:path => 'spec/test_data/external_paths/1.html') actual = TestDiff.diff([], [asset1, asset2]) actual.should eq(expected) end end
Version data entries
11 entries across 11 versions & 1 rubygems