Sha256: cd5b6cca107bd7996d6d2ba56117b2c84d95fb4aec8de3926cddddb6d972d8de

Contents?: true

Size: 1.8 KB

Versions: 13

Compression:

Stored size: 1.8 KB

Contents

require File.join(File.dirname(__FILE__),'spec_helper')

describe "Rhosync" do
  it_should_behave_like "RhosyncHelper"
  it_should_behave_like "TestappHelper"
  
  it "should bootstrap Rhosync with block" do
    Rhosync.bootstrap(get_testapp_path) do |rhosync|
      rhosync.vendor_directory = 'foo'
    end
    path = get_testapp_path
    File.expand_path(Rhosync.base_directory).should == path
    File.expand_path(Rhosync.app_directory).should == path
    File.expand_path(Rhosync.data_directory).should == File.join(path,'data')
    Rhosync.vendor_directory.should == 'foo'
    Rhosync.blackberry_bulk_sync.should == false
    Rhosync.bulk_sync_poll_interval.should == 3600
    Rhosync.environment.should == :development  
    App.is_exist?(@test_app_name).should be_true
  end
  
  it "should bootstrap Rhosync with RHO_ENV provided" do
    ENV['RHO_ENV'] = 'production'
    Rhosync.bootstrap(get_testapp_path)
    Rhosync.environment.should == :production
    ENV.delete('RHO_ENV')
  end
  
  it "should bootstrap with existing app" do
    app = App.create(:name => @test_app_name)
    App.should_receive(:load).once.with(@test_app_name).and_return(app)
    Rhosync.bootstrap(get_testapp_path)
  end

  it "should bootstrap app with no sources" do
    app = App.create(:name => @test_app_name)
    Rhosync.stub!(:get_config).and_return(
      { Rhosync.environment.to_sym => { :licensefile => 'settings/license.key' } }
    )
    App.should_receive(:load).twice.with(@test_app_name).and_return(app)
    Rhosync.bootstrap(get_testapp_path)
    App.load(@test_app_name).sources.members.should == []
  end
  
  it "should add associations during bootstrap" do
    Rhosync.bootstrap(get_testapp_path)
    s = Source.load('SampleAdapter',{:app_id => @test_app_name,:user_id => '*'})
    s.has_many.should == "FixedSchemaAdapter,brand"
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rhosync-2.0.8 spec/rhosync_spec.rb
rhosync-2.0.7 spec/rhosync_spec.rb
rhosync-2.0.6 spec/rhosync_spec.rb
rhosync-2.0.5 spec/rhosync_spec.rb
rhosync-2.0.4 spec/rhosync_spec.rb
rhosync-2.0.3 spec/rhosync_spec.rb
rhosync-2.0.2 spec/rhosync_spec.rb
rhosync-2.0.1 spec/rhosync_spec.rb
rhosync-2.0.0 spec/rhosync_spec.rb
rhosync-2.0.0.rc2 spec/rhosync_spec.rb
rhosync-2.0.0.rc1 spec/rhosync_spec.rb
rhosync-2.0.0.beta13 spec/rhosync_spec.rb
rhosync-2.0.0.beta12 spec/rhosync_spec.rb