Sha256: 83a247e937b82850afc113780fd6ad1eb070711fb956bf362fe0da7a7b793181

Contents?: true

Size: 1.53 KB

Versions: 8

Compression:

Stored size: 1.53 KB

Contents

# Copyright:: (c) Autotelik Media Ltd 2011
# Author ::   Tom Statter
# Date ::     Summer 2012
#
# License::   MIT - Free, OpenSource
#
# Details::   Specification for Spree generator aspect of datashift gem.
#
#             Provides Loaders and rake tasks specifically tailored for uploading or exporting
#             Spree Products, associations and Images
#
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")

require 'excel_exporter'

describe 'SpreeExporter' do
  
  before(:all) do

    before_all_spree

    results_clear()
  end


  before(:each) do

    before_each_spree   # inits tests, cleans DB setups model types
    
    # Create some test data
    root = @Taxonomy_klass.create( :name => 'Paintings' )
 
    @Taxon_klass.create( :name => 'Landscape', :description => "Nice paintings", :taxonomy_id => root.id )
    @Taxon_klass.create( :name => 'Sea', :description => "Waves and sand", :taxonomy_id => root.id )
  end

  it "should export any Spree model to .xls spreedsheet" do

    expect = result_file('taxon_export_spec.xls')

    exporter = DataShift::ExcelExporter.new(expect)

    items = @Taxon_klass.all

    exporter.export(items)

    File.exists?(expect).should be_true
  end

  it "should export a Spree model and associations to .xls spreedsheet" do

    expect = result_file('taxon_and_assoc_export_spec.xls')

    exporter = DataShift::ExcelExporter.new(expect)

    items = @Taxon_klass.all
      
    exporter.export_with_associations(@Taxon_klass, items)

    File.exists?(expect).should be_true

  end
    
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
datashift_spree-0.5.0 spec/spree_exporter_spec.rb
datashift_spree-0.4.2 spec/spree_exporter_spec.rb
datashift_spree-0.4.1 spec/spree_exporter_spec.rb
datashift_spree-0.4.0 spec/spree_exporter_spec.rb
datashift_spree-0.3.0 spec/spree_exporter_spec.rb
datashift_spree-0.2.1 spec/spree_exporter_spec.rb
datashift_spree-0.2.0 spec/spree_exporter_spec.rb
datashift_spree-0.1.0 spec/spree_exporter_spec.rb