Sha256: bb53b42897b662eba8deffb66c0952a911ac8de0621d6c78c743c98c43e087ee

Contents?: true

Size: 1.7 KB

Versions: 20

Compression:

Stored size: 1.7 KB

Contents

require "spec_helper"
require "class_list"

module Marty

groupings =<<EOF
name
g1
g2
g3
EOF

heads =<<EOF
name	condition_text
h1	foo
h2	bar
h3	baz
EOF

head_versions =<<EOF
head__name	version	result_text
h1	base	x=1
h1	600	x=2
h2	base	y=z
h3	base	z=4
EOF

grouping_head_versions =<<EOF
grouping__name	head_version__head	head_version__version
g1	h1	base
g1	h1	600
g2	h2	base
g3	h3	base
EOF

  describe DataExporter do
    it "be able to import and export nested keys" do
      res = Marty::DataImporter.do_import_summary(Gemini::Grouping, groupings)
      expect(res).to eq({create: 3})
      Gemini::Grouping.count.should == 3

      res = Marty::DataImporter.do_import_summary(Gemini::Head, heads)
      expect(res).to eq({create: 3})
      Gemini::Head.count.should == 3

      res = Marty::DataImporter.do_import_summary(Gemini::HeadVersion, head_versions)
      expect(res).to eq({create: 4})
      Gemini::HeadVersion.count.should == 4

      res = Marty::DataImporter.do_import_summary(Gemini::GroupingHeadVersion, grouping_head_versions)
      expect(res).to eq({create: 4})
      Gemini::GroupingHeadVersion.count.should == 4

      res = Marty::DataExporter.do_export('infinity', Gemini::GroupingHeadVersion)

      expect(res).to eq [
                         ["grouping", "head_version__head", "head_version__version"],
                         ["g1", "h1", "base"],
                         ["g1", "h1", "600"],
                         ["g2", "h2", "base"],
                         ["g3", "h3", "base"]
                        ]

      csv = Marty::DataExporter.to_csv(res, col_sep: "\t")

      res = Marty::DataImporter.do_import_summary(Gemini::GroupingHeadVersion, csv)

      expect(res).to eq({same: 4})
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
marty-0.5.36 spec/lib/data_exporter_spec.rb
marty-0.5.35 spec/lib/data_exporter_spec.rb
marty-0.5.34 spec/lib/data_exporter_spec.rb
marty-0.5.33 spec/lib/data_exporter_spec.rb
marty-0.5.32 spec/lib/data_exporter_spec.rb
marty-0.5.31 spec/lib/data_exporter_spec.rb
marty-0.5.30 spec/lib/data_exporter_spec.rb
marty-0.5.29 spec/lib/data_exporter_spec.rb
marty-0.5.28 spec/lib/data_exporter_spec.rb
marty-0.5.27 spec/lib/data_exporter_spec.rb
marty-0.5.26 spec/lib/data_exporter_spec.rb
marty-0.5.25 spec/lib/data_exporter_spec.rb
marty-0.5.24 spec/lib/data_exporter_spec.rb
marty-0.5.23 spec/lib/data_exporter_spec.rb
marty-0.5.21 spec/lib/data_exporter_spec.rb
marty-0.5.20 spec/lib/data_exporter_spec.rb
marty-0.5.19 spec/lib/data_exporter_spec.rb
marty-0.5.18 spec/lib/data_exporter_spec.rb
marty-0.5.17 spec/lib/data_exporter_spec.rb
marty-0.5.16 spec/lib/data_exporter_spec.rb