Sha256: a2976b2fa4a172c6da9035745228820eb50287ffc6e3c7ac99571fa80d62d0c5

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'
require 'bundler'

describe Bundler do
  describe "#load_gemspec_uncached" do

    before do
      @gemspec = tmp("test.gemspec")
      @gemspec.open('wb') do |f|
        f.write strip_whitespace(<<-GEMSPEC)
          ---
            {:!00 ao=gu\g1= 7~f
        GEMSPEC
      end
    end

    describe "on Ruby 1.8", :ruby => "1.8" do
      it "should catch YAML syntax errors" do
        expect { Bundler.load_gemspec_uncached(@gemspec) }.
          to raise_error(Bundler::GemspecError)
      end
    end

    context "on Ruby 1.9", :ruby => "1.9" do
      context "with Syck as YAML::Engine" do
        it "raises a GemspecError after YAML load throws ArgumentError" do
          orig_yamler, YAML::ENGINE.yamler = YAML::ENGINE.yamler, 'syck'

          expect { Bundler.load_gemspec_uncached(@gemspec) }.
            to raise_error(Bundler::GemspecError)

          YAML::ENGINE.yamler = orig_yamler
        end
      end

      context "with Psych as YAML::Engine" do
        it "raises a GemspecError after YAML load throws Psych::SyntaxError" do
          orig_yamler, YAML::ENGINE.yamler = YAML::ENGINE.yamler, 'psych'

          expect { Bundler.load_gemspec_uncached(@gemspec) }.
            to raise_error(Bundler::GemspecError)

          YAML::ENGINE.yamler = orig_yamler
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bundler-1.3.0.pre.7 spec/bundler/bundler_spec.rb
bundler-1.3.0.pre.6 spec/bundler/bundler_spec.rb
bundler-1.3.0.pre.5 spec/bundler/bundler_spec.rb
bundler-1.3.0.pre.4 spec/bundler/bundler_spec.rb
bundler-1.3.0.pre.3 spec/bundler/bundler_spec.rb
bundler-1.3.0.pre.2 spec/bundler/bundler_spec.rb