diff options
author | Carl Lerche <carllerche@mac.com> | 2010-05-10 13:32:53 +0300 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-05-10 13:32:53 +0300 |
commit | b10739810f28ddf60efbe2348ed16da52ea872d6 (patch) | |
tree | a9bf4d7126b09966d79a6df05bb864194ae407ce | |
parent | 2b9094e9d0f0cc21d8acf503da98fd908e29f6ff (diff) | |
download | bundler-b10739810f28ddf60efbe2348ed16da52ea872d6.tar.gz |
Update the lockfile format specs to the new format
-rw-r--r-- | spec/lock/flex_spec.rb | 284 |
1 files changed, 150 insertions, 134 deletions
diff --git a/spec/lock/flex_spec.rb b/spec/lock/flex_spec.rb index bdb35831..b5504da1 100644 --- a/spec/lock/flex_spec.rb +++ b/spec/lock/flex_spec.rb @@ -1,8 +1,21 @@ require "spec_helper" describe "the lockfile format" do - before :each do - pending + + def be_with_diff(expected) + # Trim the leading spaces + spaces = expected[/\A\s+/, 0] || "" + expected.gsub!(/^#{spaces}/, '') + + simple_matcher "should be" do |given, m| + m.failure_message = "The lockfile did not match what you expected:\n===============\n" << Differ.diff_by_line(expected, given).to_s << "\n===============\n" + expected == given + end + end + + def lockfile_should_be(expected) + lock = File.read(bundled_app("Gemfile.lock")) + lock.should be_with_diff(expected) end it "generates a simple lockfile for a single source, gem" do @@ -13,14 +26,13 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - gem: file:#{gem_repo1}/ + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) - dependencies: + DEPENDENCIES rack - - specs: - rack (1.0.0) G end @@ -32,35 +44,18 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - gem: file:#{gem_repo1}/ - - dependencies: + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) + rack-obama (1.0) + rack + + DEPENDENCIES rack-obama - - specs: - rack (1.0.0) - rack-obama (1.0): - rack G end - def be_with_diff(expected) - # Trim the leading spaces - spaces = expected[/\A\s+/, 0] || "" - expected.gsub!(/^#{spaces}/, '') - - simple_matcher "should be" do |given, m| - m.failure_message = "The lockfile did not match what you expected:\n===============\n" << Differ.diff_by_line(expected, given).to_s << "\n===============\n" - expected == given - end - end - - def lockfile_should_be(expected) - lock = File.read(bundled_app("Gemfile.lock")) - expected.should be_with_diff(lock) - end - it "generates a simple lockfile for a single source, gem with a version requirement" do flex_install_gemfile <<-G source "file://#{gem_repo1}" @@ -69,16 +64,15 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - gem: file:#{gem_repo1}/ - - dependencies: + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) + rack-obama (1.0) + rack + + DEPENDENCIES rack-obama (>= 1.0) - - specs: - rack (1.0.0) - rack-obama (1.0): - rack G end @@ -90,12 +84,17 @@ describe "the lockfile format" do G lockfile_should_be <<-G - dependencies: - foo: - git: #{lib_path("foo-1.0")} ref:"#{git.ref_for('master', 6)}" + GIT + remote: #{lib_path("foo-1.0")} + ref: #{git.ref_for('master', 6)} + specs: + foo (1.0) + + GEM + specs: - specs: - foo (1.0) + DEPENDENCIES + foo! G end @@ -108,14 +107,17 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - git: #{lib_path('foo-1.0')} ref:"#{git.ref_for('master', 6)}" + GIT + remote: #{lib_path('foo-1.0')} + ref: #{git.ref_for('master', 6)} + specs: + foo (1.0) - dependencies: - foo + GEM + specs: - specs: - foo (1.0) + DEPENDENCIES + foo G end @@ -128,12 +130,17 @@ describe "the lockfile format" do G lockfile_should_be <<-G - dependencies: - foo: - git: #{lib_path("foo-1.0")} ref:"#{git.ref_for('omg', 6)}" + GIT + remote: #{lib_path("foo-1.0")} + ref: #{git.ref_for('omg', 6)} + specs: + foo (1.0) + + GEM + specs: - specs: - foo (1.0) + DEPENDENCIES + foo! G end @@ -146,12 +153,17 @@ describe "the lockfile format" do G lockfile_should_be <<-G - dependencies: - foo: - git: #{lib_path("foo-1.0")} ref:"#{git.ref_for('omg', 6)}" + GIT + remote: #{lib_path("foo-1.0")} + ref: #{git.ref_for('omg', 6)} + specs: + foo (1.0) + + GEM + specs: - specs: - foo (1.0) + DEPENDENCIES + foo! G end @@ -163,12 +175,16 @@ describe "the lockfile format" do G lockfile_should_be <<-G - dependencies: - foo: - path: #{lib_path("foo-1.0")} + PATH + remote: #{lib_path("foo-1.0")} + specs: + foo (1.0) - specs: - foo (1.0) + GEM + specs: + + DEPENDENCIES + foo! G end @@ -182,23 +198,22 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - gem: file:#{gem_repo1}/ - - dependencies: + GEM + remote: file:#{gem_repo1}/ + specs: + actionpack (2.3.2) + activesupport (= 2.3.2) + activesupport (2.3.2) + rack (1.0.0) + rack-obama (1.0) + rack + thin (1.0) + rack + + DEPENDENCIES actionpack rack-obama thin - - specs: - actionpack (2.3.2): - activesupport (= 2.3.2) - activesupport (2.3.2) - rack (1.0.0) - rack-obama (1.0): - rack - thin (1.0): - rack G end @@ -210,29 +225,28 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - gem: file:#{gem_repo1}/ - - dependencies: + GEM + remote: file:#{gem_repo1}/ + specs: + actionmailer (2.3.2) + activesupport (= 2.3.2) + actionpack (2.3.2) + activesupport (= 2.3.2) + activerecord (2.3.2) + activesupport (= 2.3.2) + activeresource (2.3.2) + activesupport (= 2.3.2) + activesupport (2.3.2) + rails (2.3.2) + actionmailer (= 2.3.2) + actionpack (= 2.3.2) + activerecord (= 2.3.2) + activeresource (= 2.3.2) + rake + rake (0.8.7) + + DEPENDENCIES rails - - specs: - actionmailer (2.3.2): - activesupport (= 2.3.2) - actionpack (2.3.2): - activesupport (= 2.3.2) - activerecord (2.3.2): - activesupport (= 2.3.2) - activeresource (2.3.2): - activesupport (= 2.3.2) - activesupport (2.3.2) - rails (2.3.2): - actionmailer (= 2.3.2) - actionpack (= 2.3.2) - activerecord (= 2.3.2) - activeresource (= 2.3.2) - rake - rake (0.8.7) G end @@ -244,16 +258,15 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - gem: file:#{gem_repo1}/ - - dependencies: + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) + rack-obama (1.0) + rack + + DEPENDENCIES rack-obama (>= 1.0) - - specs: - rack (1.0.0) - rack-obama (1.0): - rack G end @@ -265,16 +278,15 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - gem: file:#{gem_repo1}/ - - dependencies: + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) + rack-obama (1.0) + rack + + DEPENDENCIES rack-obama (>= 1.0) - - specs: - rack (1.0.0) - rack-obama (1.0): - rack G end @@ -287,14 +299,16 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - path: foo + PATH + remote: foo + specs: + foo (1.0) - dependencies: - foo + GEM + specs: - specs: - foo (1.0) + DEPENDENCIES + foo G end @@ -307,14 +321,16 @@ describe "the lockfile format" do G lockfile_should_be <<-G - sources: - path: foo + PATH + remote: foo + specs: + foo (1.0) - dependencies: - foo + GEM + specs: - specs: - foo (1.0) + DEPENDENCIES + foo G end end
\ No newline at end of file |