Sha256: 1d1b2fba4e4273b8201c1938c23a14c6ed8e06ea918ab70f28f0b3a85b1f846c

Contents?: true

Size: 888 Bytes

Versions: 6

Compression:

Stored size: 888 Bytes

Contents

require 'rails_helper'

RSpec.describe Newsletter::Design do
  before(:each) do 
    @design = import_design(nil,"My Design")
  end

  it "sets the name correctly" do
    expect(@design.name).to eq("My Design")
  end

  context "whether it exports and imports correctly" do
    it "doesn't blow up" do
      reimported_design = nil
      Tempfile.open(["design", ".yml"], 'tmp') do |design_file|
        design_file.close
        @design.export(design_file.path)
        reimported_design = Newsletter::Design.import(design_file.path, 
          "My Re-Imported Design"
        )
      end
      and_it "has the same elements" do
        expect(@design.elements.pluck(:name).sort).to eq reimported_design.elements.
          pluck(:name).sort
      end
      and_it "knows its images" do
        expect(@design.images).to include("newsletter_header.png")
      end
    end
    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
newsletter-3.2.6 spec/test_app/spec/models/newsletter/design_spec.rb
newsletter-3.2.5 spec/test_app/spec/models/newsletter/design_spec.rb
newsletter-3.2.4 spec/test_app/spec/models/newsletter/design_spec.rb
newsletter-3.2.2 spec/test_app/spec/models/newsletter/design_spec.rb
newsletter-3.2.1 spec/test_app/spec/models/newsletter/design_spec.rb
newsletter-3.2.0 spec/test_app/spec/models/newsletter/design_spec.rb