Sha256: a0592bc72ab4131a55ab99cbf35f459d996cbf1ba6a896a6b8ef7928ac47d951

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Andrake::Manifest do
  before do
    @manifest_filename = File.expand_path(File.dirname(__FILE__) + '/AndroidManifest.xml')

    @manifest_xml = File.read(@manifest_filename)
  end

  describe "class methods" do
    subject { Andrake::Manifest }
    its(:manifest_file) { should eq("AndroidManifest.xml") }

    describe ".load" do
      before do
        Andrake::Manifest.stub(:manifest_file) { @manifest_filename }
      end
      it "should create instance with contents of xml file" do
        subject.should_receive(:new).with(@manifest_xml)
        subject.load
      end
    end
  end

  describe "instance methods" do
    before do
      Andrake::Manifest.stub(:manifest_file) { @manifest_filename }
    end

    subject { Andrake::Manifest.new(@manifest_xml) }
    describe "#save" do
      after do
        File.open(@manifest_filename, 'w') do |f|
          f.write @manifest_xml
        end
      end

      it "should be equal to src file" do
        subject.save
        Nokogiri::XML(File.read(@manifest_filename)).to_s.should eq(subject.instance_variable_get(:@document).to_s)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
andrake-1.1.1 spec/manifest/manifest_spec.rb
andrake-1.1.0 spec/manifest/manifest_spec.rb
andrake-1.0.0 spec/manifest/manifest_spec.rb