Browse files

Whitespace cleanup

  • Loading branch information...
1 parent 106f215 commit 7a71becbacaeadf8b372d5be89d317596cbabca2 @wycats wycats committed Aug 19, 2010
Showing with 1,074 additions and 1,074 deletions.
  1. +15 −15 spec/buildtasks/build/copy_spec.rb
  2. +4 −4 spec/buildtasks/build/spec_helper.rb
  3. +8 −8 spec/buildtasks/manifest/catalog_spec.rb
  4. +14 −14 spec/buildtasks/manifest/hide_buildfiles_spec.rb
  5. +12 −12 spec/buildtasks/manifest/localize_spec.rb
  6. +60 −60 spec/buildtasks/manifest/prepare_build_tasks/bundle_spec.rb
  7. +43 −43 spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb
  8. +11 −11 spec/buildtasks/manifest/prepare_build_tasks/css_spec.rb
  9. +28 −28 spec/buildtasks/manifest/prepare_build_tasks/html_spec.rb
  10. +9 −9 spec/buildtasks/manifest/prepare_build_tasks/javascript_spec.rb
  11. +8 −8 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
  12. +22 −22 spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb
  13. +14 −14 spec/buildtasks/manifest/prepare_build_tasks/sass_spec.rb
  14. +10 −10 spec/buildtasks/manifest/prepare_build_tasks/strings_spec.rb
  15. +27 −27 spec/buildtasks/manifest/prepare_build_tasks/tests_spec.rb
  16. +6 −6 spec/buildtasks/manifest/prepare_spec.rb
  17. +5 −5 spec/buildtasks/manifest/spec_helper.rb
  18. +32 −32 spec/buildtasks/target_spec.rb
  19. +9 −9 spec/lib/builders/combine_spec.rb
  20. +131 −131 spec/lib/builders/html_spec.rb
  21. +9 −9 spec/lib/builders/javascript_spec.rb
  22. +7 −7 spec/lib/builders/less_spec.rb
  23. +10 −10 spec/lib/builders/sass_spec.rb
  24. +6 −6 spec/lib/builders/spec_helper.rb
  25. +10 −10 spec/lib/builders/strings_spec.rb
  26. +7 −7 spec/lib/builders/stylesheet_spec.rb
  27. +7 −7 spec/lib/builders/test_index_spec.rb
  28. +33 −33 spec/lib/builders/test_spec.rb
  29. +14 −14 spec/lib/buildfile/config_for_spec.rb
  30. +13 −13 spec/lib/buildfile/define_spec.rb
  31. +17 −17 spec/lib/buildfile/dup_spec.rb
  32. +28 −28 spec/lib/buildfile/invoke_spec.rb
  33. +11 −11 spec/lib/buildfile/load_spec.rb
  34. +12 −12 spec/lib/buildfile/task/dup_spec.rb
  35. +1 −1 spec/lib/buildfile/task_defined_spec.rb
  36. +2 −2 spec/lib/buildfile_commands/build_task_spec.rb
  37. +22 −22 spec/lib/buildfile_commands/config_spec.rb
  38. +1 −1 spec/lib/buildfile_commands/import_spec.rb
  39. +2 −2 spec/lib/buildfile_commands/namespace_spec.rb
  40. +5 −5 spec/lib/buildfile_commands/proxies_spec.rb
  41. +5 −5 spec/lib/buildfile_commands/replace_task_spec.rb
  42. +5 −5 spec/lib/buildfile_commands/task_spec.rb
  43. +4 −4 spec/lib/helpers/packing_optimizer/optimize_spec.rb
  44. +7 −7 spec/lib/models/hash_struct/deep_clone_spec.rb
  45. +8 −8 spec/lib/models/hash_struct/has_options_spec.rb
  46. +14 −14 spec/lib/models/hash_struct/hash_spec.rb
  47. +3 −3 spec/lib/models/hash_struct/merge_spec.rb
  48. +7 −7 spec/lib/models/hash_struct/method_missing.rb
  49. +6 −6 spec/lib/models/manifest/add_entry_spec.rb
  50. +14 −14 spec/lib/models/manifest/add_transform_spec.rb
  51. +17 −17 spec/lib/models/manifest/build_spec.rb
  52. +29 −29 spec/lib/models/manifest/entry_for_spec.rb
  53. +19 −19 spec/lib/models/manifest/find_entry.rb
  54. +11 −11 spec/lib/models/manifest/prepare_spec.rb
  55. +7 −7 spec/lib/models/manifest_entry/cacheable_url_spec.rb
  56. +8 −8 spec/lib/models/manifest_entry/hyperdomain_prefix.rb
  57. +9 −9 spec/lib/models/manifest_entry/prepare_spec.rb
  58. +6 −6 spec/lib/models/project/add_target_spec.rb
  59. +3 −3 spec/lib/models/project/buildfile_spec.rb
  60. +16 −16 spec/lib/models/project/find_targets_for_spec.rb
  61. +7 −7 spec/lib/models/project/load_nearest_project_spec.rb
  62. +5 −5 spec/lib/models/project/target_for_spec.rb
  63. +11 −11 spec/lib/models/project/targets_spec.rb
  64. +22 −22 spec/lib/models/target/compute_build_number_spec.rb
  65. +5 −5 spec/lib/models/target/config_spec.rb
  66. +12 −12 spec/lib/models/target/expand_required_targets_spec.rb
  67. +11 −11 spec/lib/models/target/installed_languages_spec.rb
  68. +8 −8 spec/lib/models/target/lproj_for_spec.rb
  69. +6 −6 spec/lib/models/target/manifest_for_spec.rb
  70. +2 −2 spec/lib/models/target/parent_target_spec.rb
  71. +7 −7 spec/lib/models/target/prepare_spec.rb
  72. +27 −27 spec/lib/models/target/required_targets_spec.rb
  73. +4 −4 spec/lib/models/target/target_for_spec.rb
  74. +8 −8 spec/lib/tools/build_number_spec.rb
  75. +32 −32 spec/lib/tools/gen_spec.rb
  76. +24 −24 spec/spec_helper.rb
View
30 spec/buildtasks/build/copy_spec.rb
@@ -1,60 +1,60 @@
require "buildtasks/build/spec_helper"
describe "build:copy" do
-
+
include SC::SpecHelpers
include SC::BuildSpecHelpers
-
+
before do
std_before
@task_name = 'build:copy'
@entry = @manifest.entry_for('demo.html')
@src_path = @entry.source_path
@dst_path = @entry.build_path
-
+
@entry.build_task.should == 'build:copy' # precondition
end
after do
std_after
end
-
+
it "copies from source to dst_path if dst_path does not exist" do
File.exist?(@dst_path).should be_false # precondition
-
+
run_task @entry, @dst_path
files_eql(@src_path, @dst_path).should be_true
end
-
+
it "does not run if newer file exists at dst_path" do
write_dummy(@dst_path)
make_newer(@dst_path, @src_path)
-
+
run_task
-
+
is_dummy(@dst_path).should be_true # make sure task did not copy
end
it "replaces dst_path if older file exists at dst_path" do
write_dummy(@dst_path)
make_newer(@src_path, @dst_path)
-
+
run_task
-
+
is_dummy(@dst_path).should be_false # should overrwite older file
files_eql(@src_path, @dst_path).should be_true
end
-
+
it "does not run if dst_path == src_path" do
task = @buildfile.lookup('build:copy')
expected_count = task.execute_count
-
+
@dst_path = @src_path
run_task
-
+
task.execute_count.should == expected_count # did not execute!
end
-
-
+
+
end
View
8 spec/buildtasks/build/spec_helper.rb
@@ -1,21 +1,21 @@
require "spec_helper"
module SC::BuildSpecHelpers
-
+
def std_before
@project = temp_project :real_world
@target = @project.target_for :sproutcore
@buildfile = @target.buildfile
@manifest = @target.manifest_for(:language => :fr)
-
+
@target.prepare! # make sure its ready for the manifest...
@manifest.build! # get a basic manifest good to go...
end
-
+
def std_after
@project.cleanup
end
-
+
def run_task(entry=nil, dst_path=nil)
entry ||= @entry
@buildfile.invoke @task_name,
View
16 spec/buildtasks/manifest/catalog_spec.rb
@@ -1,28 +1,28 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:catalog" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
-
+
def run_task
@manifest.prepare! # this should be run first...
super('manifest:catalog')
end
-
+
it "create an entry for each item in the target regardless of language with the relative path as filename" do
run_task
-
+
# collect filenames from target dir...
filenames = Dir.glob(File.join(@target.source_root, '**','*'))
filenames.reject! { |f| File.directory?(f) }
filenames.map! { |f| f.sub(@target.source_root + '/', '') }
filenames.reject! { |f| f =~ /^(apps|frameworks|themes)/ }
-
+
entries = @manifest.entries.dup # get entries to test...
filenames.each do |filename|
entry = entries.find { |e| e.filename == filename }
@@ -38,11 +38,11 @@ def run_task
entry.should_not be_hidden
entry.original?.should be_true # mark as original entry
end
-
+
(entry.nil? ? nil : entry.filename).should == filename
entries.delete entry
end
entries.size.should == 0
end
-
+
end
View
28 spec/buildtasks/manifest/hide_buildfiles_spec.rb
@@ -1,49 +1,49 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:hide_buildfiles" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
-
+
def run_task
@manifest.prepare!
super('manifest:hide_buildfiles')
end
-
+
it "should run manifest:catalog first" do
should_run('manifest:catalog') { run_task }
end
-
+
it "should hide any Buildfile, sc-config, or sc-config.rb" do
run_task
entry_for('Buildfile').hidden?.should be_true
end
-
+
it "should hide any non .js file outside of .lproj, test, fixture, resources & debug dirs" do
run_task
entry_for('README').hidden?.should be_true
entry_for('lib/index.html').hidden?.should be_true
-
+
entry_for('tests/sample.rhtml').hidden?.should be_false
entry_for('english.lproj/demo.html').hidden?.should be_false
entry_for('fixtures/sample-json-fixture.json').hidden?.should be_false
entry_for('resources/boo.png').hidden?.should be_false
entry_for('debug/debug-resource.html').hidden?.should be_false
end
-
+
it "should NOT hide non-js files inslide lproj dirs" do
run_task
entry = entry_for('english.lproj/demo.html')
entry.should_not be_hidden
end
describe "CONFIG.load_fixtures" do
-
+
it "should hide files in /fixtures and /*.lproj/fixtures if CONFIG.load_fixtures is false" do
@target.config.load_fixtures = false
run_task
@@ -52,7 +52,7 @@ def run_task
entry = entry_for('english.lproj/fixtures/sample_fixtures-loc.js')
entry.should be_hidden
end
-
+
it "should NOT hide files in /fixtures and /*.lproj/fixtures if CONFIG.load_fixtures is true" do
@target.config.load_fixtures = true
run_task
@@ -72,7 +72,7 @@ def run_task
entry = entry_for('english.lproj/debug/sample_debug-loc.js')
entry.should be_hidden
end
-
+
it "should NOT hide files in /debug and /*.lproj/debug if CONFIG.load_fixtures is true" do
@target.config.load_debug = true
run_task
@@ -92,7 +92,7 @@ def run_task
entry = entry_for('english.lproj/tests/sample-loc.js')
entry.should be_hidden
end
-
+
it "should NOT hide files in /tests and /*.lproj/tests if CONFIG.load_tests is true" do
@target.config.load_tests = true
run_task
@@ -112,7 +112,7 @@ def run_task
entry = entry_for('english.lproj/protocols/sample-loc.js')
entry.should be_hidden
end
-
+
it "should NOT hide files in /protocols and /*.lproj/protocols if config is true" do
@target.config.load_protocols = true
run_task
@@ -122,5 +122,5 @@ def run_task
entry.should_not be_hidden
end
end
-
+
end
View
24 spec/buildtasks/manifest/localize_spec.rb
@@ -1,10 +1,10 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:localize" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
@@ -13,12 +13,12 @@ def run_task
@manifest.prepare!
super('manifest:localize')
end
-
+
it "should run manifest:catalog && hide_buildfiles as prereq" do
should_run('manifest:catalog') { run_task }
should_run('manifest:hide_buildfiles') { run_task }
end
-
+
it "should not alter non-localized files" do
run_task
entry = entry_for('core.js')
@@ -36,7 +36,7 @@ def run_task
end
end
end
-
+
it "should remove foo.lproj from filename, build_path, and url of localized except for css and js files, which get 'lproj' instead" do
run_task
@manifest.entries.each do |entry|
@@ -45,39 +45,39 @@ def run_task
if entry.ext == 'js'
new_filename = "lproj/#{new_filename}"
end
-
+
entry.filename.should eql(new_filename)
entry.build_path = File.join(@manifest.build_root, new_filename.split('/'))
entry.url = [@manifest.url_root, new_filename.split('/')].flatten.join('/')
end
end
-
+
it "should assign language to localized entries" do
run_task
# we just test this by spot checking to make sure any entry in the
# french.lproj actually has a french language code assigned...
@manifest.entries.each do |entry|
next unless entry.localize? && (entry.source_path =~ /french\.lproj/)
- entry.language.should eql(:fr)
+ entry.language.should eql(:fr)
end
end
-
+
it "should not hide resources in current language" do
run_task
entry = entry_for('lproj/french-resource.js')
entry.localized?.should be_true
entry.should_not be_hidden
entry.language.should eql(:fr)
end
-
+
it "should not hide resource in preferred language that are not also found in current language" do
run_task
entry = entry_for('demo.html')
entry.localized?.should be_true
entry.language.should eql(:en)
entry.should_not be_hidden
end
-
+
it "should prefer resource in current language over those in preferred language" do
run_task
# a 'strings.js' is defined in english.lproj, french.lproj, & german
@@ -87,7 +87,7 @@ def run_task
entry.should_not be_hidden
entry.language.should eql(:fr)
end
-
+
it "should hide resources in languages not part of current language or preferred language" do
run_task
entry = entry_for('lproj/german-resource.js')
View
120 spec/buildtasks/manifest/prepare_build_tasks/bundle_spec.rb
@@ -1,131 +1,131 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:prepare_build_tasks:bundle_loaded" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
describe "app target" do
-
+
before do
std_before :builder_tests, :bundle_test
-
+
# most of these tests assume load_debug is turned off like it would be
# in production mode
@target.config.load_debug = false
@target.config.theme = nil
@target.config.timestamp_urls = false
-
+
# run std rules to run manifest. Then verify preconditions to make sure
# no other changes to the build system effect the ability of these tests
# to run properly.
@manifest.build!
end
-
+
def run_task
@manifest.prepare!
super('manifest:prepare_build_tasks:javascript')
end
-
+
it "should run manifest:prepare_build_tasks:setup as prereq" do
should_run('manifest:prepare_build_tasks:setup') { run_task }
end
-
+
it "should not create a bundle_loaded.js entry for an app" do
run_task
@manifest.entry_for('bundle_loaded.js').should be_nil
end
-
+
end
-
+
describe "static framework target" do
-
+
before do
std_before :builder_tests, :req_target_1
-
+
# most of these tests assume load_debug is turned off like it would be
# in production mode
@target.config.load_debug = false
@target.config.theme = nil
@target.config.timestamp_urls = false
-
+
# run std rules to run manifest. Then verify preconditions to make sure
# no other changes to the build system effect the ability of these tests
# to run properly.
@manifest.build!
end
-
+
def run_task
@manifest.prepare!
super('manifest:prepare_build_tasks:javascript')
end
-
+
it "should run manifest:prepare_build_tasks:setup as prereq" do
should_run('manifest:prepare_build_tasks:setup') { run_task }
end
-
+
it "should create a bundle_loaded.js entry" do
run_task
@manifest.entry_for('bundle_loaded.js').should_not be_nil
end
-
+
end
-
+
describe "dynamic framework target" do
-
+
before do
std_before :builder_tests, :req_target_2
-
+
# most of these tests assume load_debug is turned off like it would be
# in production mode
@target.config.load_debug = false
@target.config.theme = nil
@target.config.timestamp_urls = false
-
+
# run std rules to run manifest. Then verify preconditions to make sure
# no other changes to the build system effect the ability of these tests
# to run properly.
@manifest.build!
end
-
+
def run_task
@manifest.prepare!
super('manifest:prepare_build_tasks:javascript')
end
-
+
it "should run manifest:prepare_build_tasks:setup as prereq" do
should_run('manifest:prepare_build_tasks:setup') { run_task }
end
-
+
it "should create a bundle_loaded.js entry" do
run_task
@manifest.entry_for('bundle_loaded.js').should_not be_nil
end
-
+
end
-
+
end
describe "manifest:prepare_build_tasks:bundle_info" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before :builder_tests, :bundle_test
-
+
# most of these tests assume load_debug is turned off like it would be
# in production mode
@target.config.load_debug = false
@target.config.theme = nil
@target.config.timestamp_urls = false
-
+
# run std rules to run manifest. Then verify preconditions to make sure
# no other changes to the build system effect the ability of these tests
# to run properly.
@manifest.build!
end
-
+
it "should create a bundle_info.js for a dynamic_required target" do
# run_task
# entries = @manifest.entries.select { |e| e.entry_type == :javascript }
@@ -135,120 +135,120 @@ def run_task
# end
# end
end
-
+
describe "app target" do
-
+
before do
std_before :builder_tests, :bundle_test
-
+
# most of these tests assume load_debug is turned off like it would be
# in production mode
@target.config.load_debug = false
@target.config.theme = nil
@target.config.use_packed = false
@target.config.timestamp_urls = false
-
+
# make sure all targets have the same settings...
@target.expand_required_targets.each do |t|
t.config.timestamp_urls = false
end
-
+
# make sure all targets have the same settings...
@target.dynamic_required_targets.each do |t|
t.config.timestamp_urls = false
end
-
+
# run std rules to run manifest. Then verify preconditions to make sure
# no other changes to the build system effect the ability of these tests
# to run properly.
@manifest.build!
end
-
+
def run_task
@manifest.prepare!
super('manifest:prepare_build_tasks:javascript')
end
-
+
it "should run manifest:prepare_build_tasks:setup as prereq" do
should_run('manifest:prepare_build_tasks:setup') { run_task }
end
-
+
it "should create a bundle_info.js entry for its dynamic target" do
@manifest.entry_for('bundle_info.js').should_not be_nil
end
-
+
end
-
+
describe "static framework target" do
-
+
before do
std_before :builder_tests, :req_target_1
-
+
# most of these tests assume load_debug is turned off like it would be
# in production mode
@target.config.load_debug = false
@target.config.theme = nil
@target.config.timestamp_urls = false
-
+
# run std rules to run manifest. Then verify preconditions to make sure
# no other changes to the build system effect the ability of these tests
# to run properly.
@manifest.build!
end
-
+
def run_task
@manifest.prepare!
super('manifest:prepare_build_tasks:javascript')
end
-
+
it "should run manifest:prepare_build_tasks:setup as prereq" do
should_run('manifest:prepare_build_tasks:setup') { run_task }
end
-
+
it "should not require a dynamic framework" do
(req = @target.dynamic_required_targets).size.should == 0
end
-
+
it "should not create a bundle_info.js entry" do
@manifest.entry_for('bundle_info.js').should be_nil
end
-
+
end
-
+
describe "dynamic framework target" do
-
+
before do
std_before :builder_tests, :req_target_2
-
+
# most of these tests assume load_debug is turned off like it would be
# in production mode
@target.config.load_debug = false
@target.config.theme = nil
@target.config.timestamp_urls = false
-
+
# run std rules to run manifest. Then verify preconditions to make sure
# no other changes to the build system effect the ability of these tests
# to run properly.
@manifest.build!
end
-
+
def run_task
@manifest.prepare!
super('manifest:prepare_build_tasks:javascript')
end
-
+
it "should run manifest:prepare_build_tasks:setup as prereq" do
should_run('manifest:prepare_build_tasks:setup') { run_task }
end
-
+
it "should require its own dynamic framework" do
(req = @target.dynamic_required_targets).size.should == 1
end
-
+
it "should create a bundle_info.js entry" do
@manifest.entry_for('bundle_info.js').should_not be_nil
end
-
+
end
-
+
end
View
86 spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb
@@ -2,14 +2,14 @@
# Creates combined entries for javascript & css
describe "manifest:prepare_build_tasks:combine" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
-
+
def run_task
# capture any log warnings...
@msg = capture('stderr') {
@@ -28,12 +28,12 @@ def run_task
# stylesheet.css support
#
describe "whem CONFIG.combine_stylesheets = true" do
-
+
before do
@config.combine_stylesheets = true
run_task
end
-
+
it "creates a combined stylesheet entry for each resource named in files" do
# spot check...
entry = entry_for 'stylesheet.css'
@@ -46,11 +46,11 @@ def run_task
# Test that sass file is included...
expected = entry_for('source/demo2.css', :entry_type => :css)
entry.source_entries.should include(expected)
-
+
# Test that scss file is included...
expected = entry_for('source/demo3.css', :entry_type => :css)
entry.source_entries.should include(expected)
-
+
# Test that less file is included...
expected = entry_for('source/demo4.css', :entry_type => :css)
entry.source_entries.should include(expected)
@@ -59,39 +59,39 @@ def run_task
expected = entry_for('source/sc_resource.css', :entry_type => :css)
entry.source_entries.should include(expected)
end
-
+
it "entries have a build_task = build:combine:css" do
entry_for('stylesheet.css').build_task.should == 'build:combine'
entry_for('bar.css').build_task.should == 'build:combine'
end
-
+
it "hides source entries" do
%w(stylesheet.css bar.css).each do |filename|
entry_for(filename).source_entries.each do |entry|
entry.should be_hidden
end
end
end
-
-
+
+
describe "adds ENTRY.ordered_entries propery with entries following load order" do
-
+
before do
@project = fixture_project :ordered_entries
end
-
+
it "orders entries as lproj/strings -> core -> utils -> others alphabetically without requires" do
-
+
@target = @project.target_for :no_requires
@buildfile = @target.buildfile
@config = @target.config
@manifest = @target.manifest_for(:language => :en)
@target.prepare! # make sure its ready for the manifest...
-
+
run_task
entry = @manifest.entry_for('stylesheet.css')
- # get the expected set of ordered entries...based on contents of
+ # get the expected set of ordered entries...based on contents of
# project...
expected = %w(source/a.css source/a/a.css source/a/b.css source/B.css source/b/a.css source/c.css)
@@ -101,59 +101,59 @@ def run_task
end
it "will override default order respecting ENTRY.required" do
-
+
@target = @project.target_for :with_requires
@buildfile = @target.buildfile
@config = @target.config
@manifest = @target.manifest_for(:language => :en)
@target.prepare! # make sure its ready for the manifest...
-
+
run_task
entry = @manifest.entry_for('stylesheet.css')
- # get the expected set of ordered entries...based on contents of
+ # get the expected set of ordered entries...based on contents of
# project...
expected = %w(source/c.css source/a.css source/b.css)
entry.ordered_entries.should_not be_nil
filenames = entry.ordered_entries.map { |e| e.filename }
filenames.should eql(expected)
end
-
+
end
-
+
end
describe "when CONFIG.combine_stylesheets = false" do
-
+
before do
@config.combine_stylesheets = false
run_task
end
-
+
it "still creates combined CSS entry" do
entry = entry_for('stylesheet.css')
entry.should_not be_nil
end
-
+
it "does not hide source CSS entries" do
entry = entry_for('stylesheet.css')
entry.should_not be_nil
entry.source_entries.each { |entry| entry.should_not be_hidden }
end
end
-
+
#######################################
# javascript.js support
#
describe "whem CONFIG.combine_javascript = true" do
-
+
before do
@config.combine_javascript = true
run_task
end
-
+
it "creates a combined JS entry for each resource named in files" do
# spot check...
entry = entry_for 'javascript.js'
@@ -167,39 +167,39 @@ def run_task
expected = entry_for('source/sc_resource.js', :entry_type => :javascript)
entry.source_entries.should include(expected)
end
-
+
it "entries have a build_task = build:combine:javascript" do
%w(javascript.js bar.js).each do |filename|
entry_for(filename).build_task.should == 'build:combine'
end
end
-
+
it "hides source entries" do
%w(javascript.js bar.js).each do |filename|
entry_for(filename).source_entries.each do |entry|
entry.should be_hidden
end
end
end
-
+
describe "adds ENTRY.ordered_entries propery with entries following load order" do
-
+
before do
@project = fixture_project :ordered_entries
end
-
+
it "orders entries as lproj/strings -> core -> utils -> others alphabetically without requires -> resources/*_page.js -> main.js}" do
-
+
@target = @project.target_for :no_requires
@buildfile = @target.buildfile
@config = @target.config
@manifest = @target.manifest_for(:language => :en)
@target.prepare! # make sure its ready for the manifest...
-
+
run_task
entry = @manifest.entry_for('javascript.js')
- # get the expected set of ordered entries...based on contents of
+ # get the expected set of ordered entries...based on contents of
# project...
expected = %w(bundle_info.js source/lproj/strings.js source/core.js source/utils.js source/1.js source/a.js source/a/a.js source/a/b.js source/B.js source/b/a.js source/c.js source/t.js source/resources/main_page.js source/main.js)
@@ -209,41 +209,41 @@ def run_task
end
it "will override default order respecting ENTRY.required" do
-
+
@target = @project.target_for :with_requires
@buildfile = @target.buildfile
@config = @target.config
@manifest = @target.manifest_for(:language => :en)
@target.prepare! # make sure its ready for the manifest...
-
+
run_task
entry = @manifest.entry_for('javascript.js')
- # get the expected set of ordered entries...based on contents of
+ # get the expected set of ordered entries...based on contents of
# project... note that we require 'd', which should match 'lproj/d'
expected = %w(bundle_info.js source/c.js source/a.js source/lproj/d.js source/b.js)
entry.ordered_entries.should_not be_nil
filenames = entry.ordered_entries.map { |e| e.filename }
filenames.should eql(expected)
end
-
+
end
-
+
end
describe "when CONFIG.combine_javascript = false" do
-
+
before do
@config.combine_javascript = false
run_task
end
-
+
it "still creates combined JS entry" do
entry = entry_for('javascript.js')
entry.should_not be_nil
end
-
+
it "does not hide source JS entries" do
entry = entry_for('javascript.js')
entry.should_not be_nil
View
22 spec/buildtasks/manifest/prepare_build_tasks/css_spec.rb
@@ -2,14 +2,14 @@
# This task prepares a single CSS entry for every untagged source entry.
describe "manifest:prepare_build_tasks:css" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
-
+
def run_task
@manifest.prepare!
super('manifest:prepare_build_tasks:css')
@@ -39,11 +39,11 @@ def run_task
entry.original? && entry.ext == 'css'
end
originals.size.should > 0 # precondition
-
+
# transformed entries
entries = @manifest.entries.select { |e| e.entry_type == :css }
entries.size.should == originals.size #precondition
-
+
# one transformed entry should exist for each original entry.
entries.each do |entry|
entry.should be_transform
@@ -53,30 +53,30 @@ def run_task
end
originals.size.should == 0
end
-
+
describe "supports require() and sc_require() statements" do
-
+
it "adds a entry.required property with empty array of no requires are specified in file" do
run_task
entry = @manifest.entry_for('source/no_require.css')
entry.required.should == []
end
-
+
it "searches files for require() & sc_requires() statements and adds them to entry.required array -- (also should ignore any ext)" do
run_task
entry = @manifest.entry_for('source/has_require.css')
entry.required.sort.should == ['demo2', 'no_require']
end
-
+
end
-
+
describe "supports sc_resource() statement" do
it "sets entry.resource = 'stylesheet' if no sc_resource statement is found in files" do
run_task
entry = @manifest.entry_for('source/no_require.css')
entry.resource.should == 'stylesheet'
end
-
+
it "searches files for sc_resource() statement and stores last value in entry.resource property" do
run_task
entry = @manifest.entry_for 'source/sc_resource.css'
View
56 spec/buildtasks/manifest/prepare_build_tasks/html_spec.rb
@@ -1,10 +1,10 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:prepare_build_tasks:html" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
@@ -26,7 +26,7 @@ def run_task
entry = entry_for('no_sc_resource.rhtml')
entry.resource.should == 'index'
end
-
+
it "searches files for sc_resource() statement and stores last value in entry.resource property" do
run_task
entry = entry_for 'sc_resource.rhtml'
@@ -35,11 +35,11 @@ def run_task
end
describe "annotates entries with render_task" do
-
+
before do
run_task
end
-
+
it "file.erb => render:erubis" do
expected = entry_for('file_extension_test.html.erb')
expected.render_task.should == "render:erubis"
@@ -56,9 +56,9 @@ def run_task
end
end
-
+
describe "special case handling of index.html for loadable targets" do
-
+
before do
# load application target instead of framework...
@target = @project.target_for :contacts
@@ -70,76 +70,76 @@ def run_task
run_task
@index_entry = entry_for 'index.html'
end
-
+
it "applies these rules only to a target that is loadable" do
@target.should be_loadable # precondition
end
-
+
# an index.html is always needed for an application to load properly
# even if not explicit fragments are present in the app.
it "generates an index.html entry even if there are no source html fragments" do
@index_entry.should_not be_nil
@index_entry.source_entries.size.should == 0 # precondition
end
-
+
it "does not hide the index.html entry" do
@index_entry.should_not be_hidden
end
-
+
it "adds the include_required_targets? property to the entry" do
@index_entry.should be_include_required_targets
end
-
+
it "marks the target as loadable" do
@target.should be_loadable
end
-
+
end
-
+
describe "special case handling of index.html for frameworks" do
-
+
before do
run_task
@index_entry = entry_for 'index.html'
@bar_entry = @manifest.entry_for('bar.html')
end
-
+
it "applies these rules only to a target that is not loadable" do
@target.should_not be_loadable # precondition
end
-
+
it "hides an index.html entry" do
@index_entry.should be_hidden
end
-
+
it "does not add include_required_targets property to entry" do
@index_entry.should_not be_include_required_targets
end
-
+
it "should not hide other .html entries if the target is not loadable" do
@bar_entry.should_not be_hidden
end
-
+
end
-
+
describe "combines html entries into one output file per resource" do
-
+
before do
run_task
@index_entry = entry_for 'index.html'
@bar_entry = @manifest.entry_for('bar.html')
end
-
+
it "should be composite entries" do
@index_entry.should be_composite
@bar_entry.should be_composite
end
-
+
it "should include any files ending in .rhtml" do
expected = entry_for('file_extension_test.rhtml')
@index_entry.source_entries.should include(expected)
end
-
+
it "should include any files ending in .erb" do
expected = entry_for('file_extension_test.html.erb')
@index_entry.source_entries.should include(expected)
@@ -156,20 +156,20 @@ def run_task
@bar_entry.source_entries.should include(entry_for('sc_resource.rhtml'))
end
-
+
it "entries have a build_task = build:html" do
@index_entry.build_task.should == 'build:html'
@bar_entry.build_task.should == 'build:html'
end
-
+
it "hides source entries" do
[@index_entry, @bar_entry].each do |entry|
entry.source_entries.each do |source_entry|
source_entry.should be_hidden
end
end
end
-
+
end
end
View
18 spec/buildtasks/manifest/prepare_build_tasks/javascript_spec.rb
@@ -1,10 +1,10 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:prepare_build_tasks:javascript" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
@@ -29,37 +29,37 @@ def run_task
end
end
end
-
+
describe "supports require() and sc_require() statements" do
-
+
it "adds a entry.required property to entrys with empty array of no requires are specified in file" do
run_task
entry = entry_for('source/no_require.js')
entry.required.should == []
end
-
+
it "searches files for require() & sc_requires() statements and adds them to entry.required array -- (also should ignore any ext)" do
run_task
entry = entry_for('source/has_require.js')
entry.required.sort.should == ['demo2', 'no_require']
end
-
+
end
-
+
describe "supports sc_resource() statement" do
it "sets entry.resource = 'javascript' if no sc_resource statement is found in files" do
run_task
entry = entry_for('source/no_require.js')
entry.resource.should == 'javascript'
end
-
+
it "searches files for sc_resource() statement and stores last value in entry.resource property" do
run_task
entry =entry_for 'source/sc_resource.js'
entry.resource.should == 'bar'
end
end
-
+
end
View
16 spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb
@@ -1,10 +1,10 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:prepare_build_tasks:minify" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
@@ -15,13 +15,13 @@ def run_task
end
it "should run setup, javascript, css, and combine as prereq" do
- %w(setup javascript css sass scss less combine).each do |task_name|
+ %w(setup javascript css sass scss less combine).each do |task_name|
should_run("manifest:prepare_build_tasks:#{task_name}") { run_task }
end
end
-
+
describe "minify javascript tasks" do
-
+
def should_have_minify_javascript_tasks
entries = @manifest.entries.select { |e| e.entry_type == :javascript }
entries.each do |entry|
@@ -37,7 +37,7 @@ def should_not_have_minify_javascript_tasks
entry.should_not be_minified
end
end
-
+
it "adds task when CONFIG.minify_javascript == true" do
@target.config.minify_javascript = true
run_task
@@ -64,7 +64,7 @@ def should_not_have_minify_javascript_tasks
run_task
should_not_have_minify_javascript_tasks
end
-
+
end
-
+
end
View
44 spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb
@@ -2,14 +2,14 @@
# Creates packed combined entries for javascript & css
describe "manifest:prepare_build_tasks:packed" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
-
+
def run_task
# capture any log warnings...
@msg = capture('stderr') {
@@ -27,73 +27,73 @@ def run_task
it "should not add packed entries for apps" do
@target = @project.target_for(:contacts)
@target.target_type.should == :app # precondition
-
+
@manifest = @target.manifest_for(:language => :en)
run_task
-
+
@manifest.entry_for('javascript-packed.js').should be_nil
@manifest.entry_for('stylesheet-packed.css').should be_nil
end
-
+
it "should add packed entries for frameworks" do
# verify default target is a framework - precondition
@target.target_type.should == :framework #precondition
run_task
@manifest.entry_for('javascript-packed.js').should_not be_nil
end
-
+
#######################################
# javascript-packed.js support
#
describe "javascript-packed.js" do
-
+
before do
run_task
@entry = entry_for('javascript-packed.js')
end
-
+
it "should generate a javascript-packed.js entry" do
@entry.should_not be_nil
end
-
+
it "should include javascript.js entries from all required targets" do
@entry.source_entries.size.should > 0
@entry.source_entries.each do |entry|
entry.filename.should == 'javascript.js'
end
end
-
+
it "should include ordered_entries ordered by required target order" do
-
- # find targets, sorted by order. remove any that don't have a
+
+ # find targets, sorted by order. remove any that don't have a
# javascript.js entry.
targets = @target.expand_required_targets + [@target]
variation = @entry.manifest.variation
- targets.reject! do |t|
+ targets.reject! do |t|
t.manifest_for(variation).build!.entry_for('javascript.js').nil?
end
-
+
@entry.ordered_entries.each do |entry|
entry.target.should == targets.shift
end
end
-
+
it "should include the actual targets this packed version covers in the targets property (even those w no javascript.js)" do
targets = @target.expand_required_targets + [@target]
@entry.targets.should == targets
end
-
+
it "should NOT include minified source entries" do
@entry.source_entries.each do |entry|
entry.should_not be_minified
end
end
-
+
it "should be marked as packed" do
@entry.should be_packed
end
-
+
end
#######################################
@@ -119,11 +119,11 @@ def run_task
it "should include ordered_entries ordered by required target order" do
- # find targets, sorted by order. remove any that don't have a
+ # find targets, sorted by order. remove any that don't have a
# javascript.js entry.
targets = @target.expand_required_targets + [@target]
variation = @entry.manifest.variation
- targets.reject! do |t|
+ targets.reject! do |t|
t.manifest_for(variation).build!.entry_for('stylesheet.css').nil?
end
@@ -148,5 +148,5 @@ def run_task
end
end
-
+
end
View
28 spec/buildtasks/manifest/prepare_build_tasks/sass_spec.rb
@@ -1,10 +1,10 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:prepare_build_tasks:sass" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
@@ -17,25 +17,25 @@ def run_task
it "should run manifest:prepare_build_tasks:setup as prereq" do
should_run('manifest:prepare_build_tasks:setup') { run_task }
end
-
+
it "should create a transform entry (with entry_type == :css) for every sass entry" do
run_task
entries = @manifest.entries(:hidden => true)
-
+
# find all entries referencing original source...
source_entries = entries.reject do |entry|
!(entry.original? && entry.filename =~ /\.sass$/)
end
source_entries.size.should > 0 # precondition
-
+
# final all test transform entries.
test_entries = entries.reject { |e| e.entry_type != :css }
test_entries.size.should eql(source_entries.size) # 1 for each entry?
test_entries.each do |entry|
source_entries.should include(entry.source_entry)
source_entries.delete(entry.source_entry) # avoid double counting
end
-
+
# none should be left...
source_entries.size.should == 0
end
@@ -45,40 +45,40 @@ def run_task
before do
run_task
- @entries = @manifest.entries.reject do |e|
+ @entries = @manifest.entries.reject do |e|
!(e.entry_type == :css && e.source_entry.filename =~ /\.sass$/)
end
end
-
+
it "adds 'source' to filename + build_path + url" do
@entries.each do |entry|
entry.filename.should =~ /^source\//
entry.build_path.should =~ /source/
entry.url.should =~ /source/
end
end
-
+
it "changes the filename + build_path + url ext to .css" do
@entries.each do |entry|
File.extname(entry.filename).should == '.css'
File.extname(entry.build_path).should == '.css'
File.extname(entry.url).should == '.css'
end
end
-
+
it "assigns a build_task of build:sass" do
@entries.each do |entry|
entry.build_task.to_s.should == 'build:sass'
end
end
-
+
it "hides the source entry" do
@entries.each do |entry|
entry.source_entry.should be_hidden
end
end
- #### NOTE: Currently build directives such as sc_require() and
+ #### NOTE: Currently build directives such as sc_require() and
#### sc_resource() are not supported in sass files. These rules test that
#### some basics are filled in anyway. Feel free to add support for said
#### directive processing if you need it and change these tests! :-)
@@ -87,12 +87,12 @@ def run_task
entry.resource.should == 'stylesheet'
end
end
-
+
it "sets the entry.required => []" do
@entries.each do |entry|
entry.required.should == []
end
end
-
+
end # describe sass -> css transform entry
end
View
20 spec/buildtasks/manifest/prepare_build_tasks/strings_spec.rb
@@ -2,14 +2,14 @@
# Creates combined entries for javascript & css
describe "manifest:prepare_build_tasks:Strings" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
-
+
def run_task
@manifest.prepare!
super('manifest:prepare_build_tasks:strings')
@@ -27,37 +27,37 @@ def run_task
end
describe "transform entry" do
-
+
before do
run_task
@entry = @manifest.entry_for('strings.yaml', :hidden => true)
end
-
+
it "should hide entry" do
@entry.should be_hidden
end
-
+
it "has entry_type = :strings" do
@entry.entry_type.should == :strings
end
it "should not hide source entry" do
@entry.source_entry.should_not be_hidden
end
-
+
it "has source/lproj/strings.js as source entry" do
@entry.source_entry.filename.should == 'source/lproj/strings.js'
end
-
+
it "has ext of 'yaml'" do
@entry.ext.should == 'yaml'
@entry.filename.should =~ /\.yaml$/
end
-
+
it "has build task of build:strings" do
@entry.build_task.to_s.should == 'build:strings'
end
-
+
end
end
View
54 spec/buildtasks/manifest/prepare_build_tasks/tests_spec.rb
@@ -1,10 +1,10 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:prepare_build_tasks:tests" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before #load real_world project
end
@@ -19,22 +19,22 @@ def run_task(load_tests=true)
should_run('manifest:catalog') { run_task }
should_run('manifest:localize') { run_task }
end
-
+
it "should create a transform entry (with entry_type == :test) for every test entry with a javascript transform entry in between" do
run_task
entries = @manifest.entries(:hidden => true)
-
+
# find all entries referencing original source...
source_entries = entries.reject do |entry|
!(entry.original? && entry.filename =~ /^tests\//)
end
source_entries.size.should > 0 # precondition
-
+
# final all test transform entries - i.e. those working on single tests.
test_entries = entries.select do |e|
e.entry_type == :test && e.transform?
end
-
+
test_entries.size.should eql(source_entries.size) # 1 for each entry?
test_entries.each do |entry|
@@ -46,51 +46,51 @@ def run_task(load_tests=true)
original.build_task.should == 'build:javascript'
original = original.source_entry # get true original to test with...
end
-
- # get original and delete from found originals to make sure chain
+
+ # get original and delete from found originals to make sure chain
# exists...
original.should be_original # precondition
source_entries.should include(original)
source_entries.delete(original) # avoid double counting
end
-
+
# none should be left...
source_entries.size.should == 0
end
-
+
it "should create a composite entry for all tests" do
run_task
-
+
# find all entries referencing original source...
entries = @manifest.entries(:hidden => true)
source_entries = entries.reject do |entry|
!(entry.original? && entry.filename =~ /^tests\//)
end
source_entries.sort! { |a,b| a.filename.to_s <=> b.filename.to_s }
-
+
# find composite test entry
entry = @manifest.entry_for 'tests.html', :entry_type => :test
entry.should_not be_nil
-
- # get originals. since some entries will be JS transforms, just walk
+
+ # get originals. since some entries will be JS transforms, just walk
# back...
originals = entry.source_entries.map do |entry|
entry.transform? ? entry.source_entry : entry
end
found = originals.sort { |a,b| a.filename.to_s <=> b.filename.to_s }
found.should == source_entries
- end
+ end
it "should create a composite entry for each nested directory" do
run_task
-
+
# find all entries referencing original source...
entries = @manifest.entries(:hidden => true)
source_entries = entries.reject do |entry|
!(entry.original? && entry.filename =~ /^tests\/nested\//)
end
source_entries.sort! { |a,b| a.filename.to_s <=> b.filename.to_s }
-
+
# find composite test entry
entry = @manifest.entry_for 'tests/nested.html', :entry_type => :test
entry.should_not be_nil
@@ -99,7 +99,7 @@ def run_task(load_tests=true)
end
found = originals.sort { |a,b| a.filename.to_s <=> b.filename.to_s }
found.should == source_entries
- end
+ end
# check the format of each entry...
describe "transform entry" do
@@ -108,52 +108,52 @@ def run_task(load_tests=true)
run_task
@entries = @manifest.entries.reject { |e| e.entry_type != :test }
end
-
+
it "changes the filename + build_path + url ext to .html" do
@entries.each do |entry|
File.extname(entry.filename).should == '.html'
File.extname(entry.build_path).should == '.html'
File.extname(entry.url).should == '.html'
end
end
-
+
it "assigns a build_task of build:test" do
@entries.each do |entry|
extname = File.extname(entry.source_entry.filename)[1..-1]
entry.build_task.to_s.should == "build:test"
end
end
-
+
end
-
+
it "should create a composite entry to generate a -index.json with test entries as source (excluding composite summary entries)" do
run_task
entry = @manifest.entry_for('tests/-index.json')
-
+
entry.should_not be_nil
entry.entry_type.should == :resource
entry.build_task.to_s.should == 'build:test_index'
- expected = @manifest.entries.select do |e|
+ expected = @manifest.entries.select do |e|
e.entry_type == :test && e.transform?
end
-
+
entry.source_entries.size.should eql(expected.size)
entry.source_entries.each do |entry|
expected.should include(entry)
expected.delete(entry) # avoid double counting
end
expected.size.should == 0 # should have an empty size...
end
-
+
it "should not hide -index.json source_entries (since they are test that need to be built)" do
run_task
entry = @manifest.entry_for('tests/-index.json')
entry.source_entries.each do |entry|
entry.should_not be_hidden
end
end
-
+
it "should not generate an -index.json entry if tests not loaded" do
run_task(false)
entry = @manifest.entry_for('tests/-index.json')
View
12 spec/buildtasks/manifest/prepare_spec.rb
@@ -1,22 +1,22 @@
require "buildtasks/manifest/spec_helper"
describe "manifest:prepare" do
-
+
include SC::SpecHelpers
include SC::ManifestSpecHelpers
-
+
before do
std_before
end
def run_task; super('manifest:prepare'); end
-
+
it "sets build_root => target.build_root/language/build_number" do
run_task
expected = File.join(@target.build_root, 'fr', @target.build_number)
@manifest.build_root.should == expected
end
-
+
it "sets staging_root => staging_root/language/build_number" do
run_task
expected = File.join(@target.staging_root, 'fr', @target.build_number)
@@ -33,11 +33,11 @@ def run_task; super('manifest:prepare'); end
run_task
@manifest.source_root.should == @target.source_root
end
-
+
it "sets index_root => index_root/language/build_number" do
run_task
expected = [@target.index_root, 'fr', @target.build_number] * '/'
@manifest.index_root.should == expected
end
-
+
end
View
10 spec/buildtasks/manifest/spec_helper.rb
@@ -8,28 +8,28 @@ def std_before(project_name = :real_world, target_name = :sproutcore)
@buildfile = @target.buildfile
@config = @target.config
@manifest = @target.manifest_for(:language => :fr)
-
+
@target.prepare! # make sure its ready for the manifest...
end
def run_task(task_name)
@buildfile.invoke task_name,
:manifest => @manifest,
- :target => @target,
- :project => @project,
+ :target => @target,
+ :project => @project,
:config => @config
end
def entry_for(filename, opts={})
@manifest.entry_for(filename, opts) || @manifest.entry_for(filename, opts.merge(:hidden => true))
end
-
+
# Verifies that the named task runs when the passed block is executed
def should_run(task_name, &block)
task = @buildfile.lookup(task_name)
first_count = task.invoke_count
yield if block_given?
task.invoke_count.should > first_count
end
-
+
end
View
64 spec/buildtasks/target_spec.rb
@@ -1,45 +1,45 @@
require "spec_helper"
describe "namespace :target" do
-
+
include SC::SpecHelpers
- # Invoked when a new target is created to fill in some standard values
+ # Invoked when a new target is created to fill in some standard values
describe "target:prepare" do
-
+
before do
@project = fixture_project :real_world
@target = @project.target_for :sproutcore
@buildfile = @target.buildfile
end
-
+
def run_task
@buildfile.invoke 'target:prepare',
:target => @target, :project => @project, :config => @target.config
end
-
- ### loadable -- if true, the target should have index.html and other files
- ### generated to make it loadable in the browser.
+
+ ### loadable -- if true, the target should have index.html and other files
+ ### generated to make it loadable in the browser.
it "sets target.loadable? if target_type == :app" do
@target.target_type = :app
run_task
@target.should be_loadable
end
-
+
### URL_ROOT -- used to compute the url for static assets
it "uses config.url_root if present" do
@target.config.url_root = 'foo'
run_task
@target.url_root.should eql('foo')
end
-
+
it "computes url_root => /url_prefix/target_name" do
@target.config.url_root.should be_nil # precondition
@target.config.url_prefix.should eql('static') # precondition
run_task
@target.url_root.should eql("/static/sproutcore")
end
-
+
it "should collapse an empty url_prefix" do
@target.config.url_root.should be_nil # precondition
@target.config.url_prefix = ''
@@ -59,49 +59,49 @@ def run_task
it "should collapse a starting /" do
@target.config.url_root.should be_nil # precondition
@target.config.url_prefix = '/foo'
-
+
run_task
@target.url_root.should eql('/foo/sproutcore')
end
-
+
it "should not add / if prefix begins with http://" do
@target.config.url_root.should be_nil # precondition
@target.config.url_prefix = "http://foo.com/blah"
-
+
run_task
@target.url_root.should eql('http://foo.com/blah/sproutcore')
end
it "should not add / if prefix begins with https://" do
@target.config.url_root.should be_nil # precondition
@target.config.url_prefix = "https://foo.com/blah"
-
+
run_task
@target.url_root.should eql('https://foo.com/blah/sproutcore')
end
it "should not add / if prefix begins with foobar://" do
@target.config.url_root.should be_nil # precondition
@target.config.url_prefix = "foobar://foo.com/blah"
-
+
run_task
@target.url_root.should eql('foobar://foo.com/blah/sproutcore')
- end
+ end
### INDEX_ROOT -- used to compute the URLs used to access index files
it "uses config.index_root if present" do
@target.config.index_root = 'foo'
run_task
@target.index_root.should eql('foo')
end
-
+
it "computes index_root => /index_prefix/target_name" do
@target.config.index_root.should be_nil # precondition
@target.config.index_prefix = 'static'
run_task
@target.index_root.should eql("/static/sproutcore")
end
-
+
it "should collapse an empty index_prefix" do
@target.config.index_root.should be_nil # precondition
@target.config.index_prefix = ''
@@ -121,26 +121,26 @@ def run_task
it "should not add / if prefix begins with http://" do
@target.config.index_root.should be_nil # precondition
@target.config.index_prefix = "http://foo.com/blah"
-
+
run_task
@target.index_root.should eql('http://foo.com/blah/sproutcore')
end