Sha256: 67ef98bfe3b420d4747754165cd6a9ae6fabd094be7373660a06b68c0c9a557a

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

describe CDM::FileWriter do
  OUTPUT_PATH = "./resources/model_definition.xcdatamodeld/model_definition.xcdatamodel/contents"

  context "test sample 1" do
    before :each do
      class ModelDefinition < CDM::EntityDefinition

        def define_model
          create_entity :foo do |e|
            e.string  :foo_string
            e.date    :foo_date
            e.int16   :foo_int
          end
        end

      end

      subject.create_model_definition
      @result = File.open(OUTPUT_PATH, "r") { |f| f.read }.split("\n")
    end

    after :all do
      File.unlink(OUTPUT_PATH)
    end

    it "defines the 'foo' entity" do
      @result[2].should eq '  <entity name="foo" syncable="YES">'
    end

    it "defines the 'foo_string' attribute" do
      @result[3].should eq '    <attribute type="String" name="foo_string" syncable="YES" optional="YES"/>'
    end

    it "defines the 'foo_date' attribute" do
      @result[4].should eq '    <attribute type="Date" name="foo_date" syncable="YES" optional="YES"/>'
    end

    it "defines the 'foo_int' attribute" do
      @result[5].should eq '    <attribute type="Integer 16" name="foo_int" syncable="YES" optional="YES" defaultValueString="0"/>'
    end

    it "closes the 'foo_entity' definition" do
      @result[6].should eq '  </entity>'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
core_data_motion-0.0.1 spec/file_writer_spec.rb