Sha256: ad80d3ce703389d35c085bc443f05306ab128c569e98d5dd5f4b424e277ecd89

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Gemline do

  describe "querying rubygems" do

    before do     
      stub_rubygems_json_output
    end

    it "should be able to parse the version out of a good json string" do
      g = Gemline.new('rails')
      expect(g.gemline).to eq(%Q{gem "rails", "~> 3.1.1"})
    end
    
    it "should whine when the gem you are querying does not exist" do
      g = Gemline.new('doesnotexist')
      g.gem_not_found?.should be_true
      expect(g.gemline).to be_nil
    end

    it "should properly detect a blocked gem name" do
      g = Gemline.new('yaml')
      expect(g.gem_not_found?).to be_true
      expect(g.gemline).to be_nil
    end

    it "should properly handle funny characters in the returned JSON" do
      g = Gemline.new('nokogiri')
      expect(g.gemline).to eq(%Q{gem "nokogiri", "~> 1.5.5"})
    end

    it "should be able to generate a gemspec-style gemline" do
      g = Gemline.new('rails', :gemspec => true)
      expect(g.gemline).to eq(%Q!gem.add_dependency "rails", ">= 3.1.1"!)
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gemline-0.3.2 spec/gemline_spec.rb
gemline-0.3.1 spec/gemline_spec.rb
gemline-0.3.0 spec/gemline_spec.rb