Sha256: c37a0b9130cfc0c326e61eea1cdd40dada176af300def726e12e56fc49f66f3f

Contents?: true

Size: 1.83 KB

Versions: 21

Compression:

Stored size: 1.83 KB

Contents

require 'spec_helper'

describe Cuesmash::Plist do

  describe "when executed" do

    before(:each) do
      @plist = Cuesmash::Plist.new("scheme", "/tmp")
      @plist.stub(:update)
      @plist.stub(:clear)
      @plist.stub(:completed)
      @plist.stub(:started)
    end

    it "should update" do
      @plist.should_receive(:update)
      @plist.execute
    end

    it "should clear" do
      @plist.should_receive(:clear)
      @plist.execute
    end
  end

  describe "when clearing" do

    before(:each) do
      @plist = Cuesmash::Plist.new("scheme", "/tmp")
      @plist.stub(:update)
      @plist.stub(:completed)
      @plist.stub(:started)
    end

    it "should delete the simulator plist" do
      @plist.stub(:simulator_plist_path){"plist_path"}
      FileUtils.should_receive(:rm).with("plist_path", anything)
      @plist.execute
    end
  end

  describe "when updating" do

    before(:each) do
      @cfplist = double(CFPropertyList::List)
      @cfplist.stub(:value)
      @cfplist.stub(:value=)
      @cfplist.stub(:save)
      CFPropertyList::List.stub(:new){@cfplist}
      CFPropertyList.stub(:native_types){@cfplist}
      CFPropertyList.stub(:guess)

      @plist = Cuesmash::Plist.new("scheme", "app_path")
      @plist.stub(:clear)
      @plist.stub(:completed)
      @plist.stub(:started)
      @plist.stub(:app_path){"app_path"}
    end

    it "should set the server ip and port" do
      @plist.stub(:server_ip){"server_ip"}
      stub_const("Cuesmash::PORT", 123)

      @cfplist.should_receive(:[]=).with("url_preference", "server_ip")
      @cfplist.should_receive(:[]=).with("port_preference", 123)

      @plist.execute
    end

    it "should write the app server plist" do
      @cfplist.should_receive(:save).with("app_path/server_config.plist", anything)
      @cfplist.stub(:[]=)

      @plist.execute
    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
cuesmash-0.2.0.0 spec/plist_spec.rb
cuesmash-0.1.9.9 spec/plist_spec.rb
cuesmash-0.1.9.8 spec/plist_spec.rb
cuesmash-0.1.9.7 spec/plist_spec.rb
cuesmash-0.1.9.6 spec/plist_spec.rb
cuesmash-0.1.9.5 spec/plist_spec.rb
cuesmash-0.1.9.4 spec/plist_spec.rb
cuesmash-0.1.9.3 spec/plist_spec.rb
cuesmash-0.1.9.2 spec/plist_spec.rb
cuesmash-0.1.9.1 spec/plist_spec.rb
cuesmash-0.1.9 spec/plist_spec.rb
cuesmash-0.1.7.1 spec/plist_spec.rb
cuesmash-0.1.7 spec/plist_spec.rb
cuesmash-0.1.6 spec/plist_spec.rb
cuesmash-0.1.5.1 spec/plist_spec.rb
cuesmash-0.1.5 spec/plist_spec.rb
cuesmash-0.1.4 spec/plist_spec.rb
cuesmash-0.1.3 spec/plist_spec.rb
cuesmash-0.1.2 spec/plist_spec.rb
cuesmash-0.1.1 spec/plist_spec.rb