Sha256: 252b91a6c938b957d51614843ee8e997552f4bdd3da7e6974e6862b56849dfb6

Contents?: true

Size: 1.2 KB

Versions: 20

Compression:

Stored size: 1.2 KB

Contents

require File.join(File.dirname(__FILE__), 'spec_helper')
describe SC::Builder::Strings do
  
  include SC::SpecHelpers
  include SC::BuilderSpecHelper
  
  before do
    std_before :strings_test

    # add fake strings entry
    @source_entry = @manifest.add_entry 'lproj/strings.js',
      :build_task => 'build:copy'
      
    @entry = @manifest.add_transform @source_entry,
      :ext => 'yaml',
      :entry_type => :yaml,
      :build_task => 'build:strings'
    
  end


  after do
    std_after
  end

  # Note, the string.js fixture file this test loads should stress the 
  # builder to make sure it can parse various cases.
  it "generates a yaml file with contents of string.js parsed into a hash" do
    dst_path = @entry.staging_path
    SC::Builder::Strings.build(@entry, dst_path)
    File.exist?(dst_path).should be_true
    
    # get YAML
    require 'yaml'
    yaml = YAML.load(File.read(dst_path))
    yaml.should_not be_nil
    
    expected = {
      'test1' => "test1",
      'test2' => 'test2 "with quotes"',
      'test3' => "test3", 
      "test4" => 'test4' 
    }
    yaml.keys.size.should == expected.keys.size
    expected.each do |key, value|
      yaml[key].should == value
    end
  end

end

    

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090407205609 spec/lib/builders/strings_spec.rb
sproutit-sproutcore-1.0.0.20090408130025 spec/lib/builders/strings_spec.rb
sproutit-sproutcore-1.0.0.20090416161445 spec/lib/builders/strings_spec.rb
sproutit-sproutcore-1.0.20090721145236 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1046 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1043 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1042 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1037 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1035 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1031 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1030 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1029 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1027 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1028 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1026 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1025 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1024 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1009 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1008 spec/lib/builders/strings_spec.rb
sproutcore-1.0.1003 spec/lib/builders/strings_spec.rb