Sha256: 2b18c7c044377c45022e57d2181eb67800e59fc609947cf2ba38528db79dc7dd

Contents?: true

Size: 1.87 KB

Versions: 34

Compression:

Stored size: 1.87 KB

Contents

require 'spec_helper'
require 'helpers/app_creator'
require 'helpers/fakable_pathman_tester'
require 'helpers/act_like_rails32'

describe 'first push' do
  before :all do
    FakablePathManTester.switch_on 'spec/fixtures/rails32/clean-install/'
  end
  before :each do
    AppCreator.create
  end

  after :all do
    AppCreator.reset
    FakablePathManTester.switch_off
  end

  it "does not do anything on a clean install" do  
    expected = RemoteAsset.all

    Asset.sync

    actual = RemoteAsset.all

    actual.should == expected
  end

 
end

describe 'happy path' do
  before :all do
    FakablePathManTester.switch_on 'spec/fixtures/rails32/happy-path/'
  end
  before :each do
    AppCreator.create
  end

  after :all do
    AppCreator.reset
    FakablePathManTester.switch_off
  end

  it "replaces the default templates by the assets" do
    expected = Asset.all
    Asset.sync
    
    actual = RemoteAsset.all
    
    actual.should == expected
    actual.each{|a| a.data.should_not be_nil }
  end
end

describe 'full path' do
  before :all do
    FakablePathManTester.switch_on 'spec/fixtures/rails32/fully-loaded/'
    ActLikeRails32.switch_on
  end
  before :each do
    AppCreator.create
  end

  after :all do
    AppCreator.reset
    FakablePathManTester.switch_off
    ActLikeRails32.switch_off
  end

  it "replaces all images" do
   local = Asset.all

   Asset.sync
   remote = RemoteAsset.all
   
   remote.count.should == 7
   local.each{|l| remote.should include(l) }
  end
  
  it "sends the good virtual paths to the server" do
    virtual_paths = ['/assets/some-other-css.css', '/assets/application.css', '/assets/rails.png']

    local = Asset.all

    Asset.sync
    
    remote = RemoteAsset.all
    
    virtual_paths.each do |p|
      local.any?{|a| a.virtual_path.to_s == p}.should  be_true
      remote.any?{|a| a.virtual_path.to_s == p }.should be_true
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
trackman-0.6.18 spec/rails32/first_push_spec.rb
trackman-0.6.17 spec/rails32/first_push_spec.rb
trackman-0.6.16 spec/rails32/first_push_spec.rb
trackman-0.6.15 spec/rails32/first_push_spec.rb
trackman-0.6.14 spec/rails32/first_push_spec.rb
trackman-0.6.13 spec/rails32/first_push_spec.rb
trackman-0.6.12 spec/rails32/first_push_spec.rb
trackman-0.6.11 spec/rails32/first_push_spec.rb
trackman-0.6.10 spec/rails32/first_push_spec.rb
trackman-0.6.9 spec/rails32/first_push_spec.rb
trackman-0.6.8 spec/rails32/first_push_spec.rb
trackman-0.6.7 spec/rails32/first_push_spec.rb
trackman-0.6.6 spec/rails32/first_push_spec.rb
trackman-0.6.5 spec/rails32/first_push_spec.rb
trackman-0.6.4 spec/rails32/first_push_spec.rb
trackman-0.6.3 spec/rails32/first_push_spec.rb
trackman-0.6.2 spec/rails32/first_push_spec.rb
trackman-0.6.1 spec/rails32/first_push_spec.rb
trackman-0.6.0 spec/rails32/first_push_spec.rb
trackman-0.5.8 spec/rails32/first_push_spec.rb