diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-07-26 13:56:42 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-08-02 15:04:28 -0500 |
commit | ededbe5e987879a0c88c0ac30552a5772ff94d1f (patch) | |
tree | 1526f3f2a5870031e7a4f55622f93dcfc1789c18 | |
parent | 6e0851c75d3ea4ecc033a1a59f0041286ede4bee (diff) | |
download | bundler-ededbe5e987879a0c88c0ac30552a5772ff94d1f.tar.gz |
Add viz specs for dot output
-rw-r--r-- | spec/commands/viz_spec.rb | 74 |
1 files changed, 70 insertions, 4 deletions
diff --git a/spec/commands/viz_spec.rb b/spec/commands/viz_spec.rb index ee5736c61d..4372ad1d1f 100644 --- a/spec/commands/viz_spec.rb +++ b/spec/commands/viz_spec.rb @@ -7,6 +7,10 @@ describe "bundle viz", :ruby => "1.9.3", :if => Bundler.which("dot") do Dir[graphviz_glob].first end + before do + ENV["RUBYOPT"] = "-I #{graphviz_lib}" + end + it "graphs gems from the Gemfile" do install_gemfile <<-G source "file://#{gem_repo1}" @@ -14,8 +18,51 @@ describe "bundle viz", :ruby => "1.9.3", :if => Bundler.which("dot") do gem "rack-obama" G - bundle "viz", :env => { "RUBYOPT" => "-I #{graphviz_lib}" } + bundle! "viz" expect(out).to include("gem_graph.png") + + bundle! "viz", :format => "dot" + expect(bundled_app("gem_graph.dot")).to read_as(strip_whitespace(<<-DOT)) + digraph Gemfile { + graph [bb="0,0,217.82,108", + concentrate=true, + nodesep=0.55, + normalize=true + ]; + node [fontname="Arial, Helvetica, SansSerif", + label="\\N" + ]; + edge [fontname="Arial, Helvetica, SansSerif", + fontsize=12, + weight=2 + ]; + default [fillcolor="#B9B9D5", + fontsize=16, + height=0.5, + label=default, + pos="32.02,90", + shape=box3d, + style=filled, + width=0.88943]; + rack [fillcolor="#B9B9D5", + height=0.5, + label=rack, + pos="161.02,18", + style=filled, + width=0.75]; + default -> rack [constraint=false, + pos="e,140.64,30.056 63.576,71.876 84.405,60.574 111.5,45.872 131.83,34.841"]; + "rack-obama" [fillcolor="#B9B9D5", + height=0.5, + label="rack-obama", + pos="161.02,90", + style=filled, + width=1.5777]; + default -> "rack-obama" [constraint=false, + pos="e,103.95,90 64.27,90 74.087,90 83.904,90 93.721,90"]; + "rack-obama" -> rack [pos="e,161.02,36.104 161.02,71.697 161.02,63.983 161.02,54.712 161.02,46.112"]; + } + DOT end it "graphs gems that are prereleases" do @@ -29,8 +76,27 @@ describe "bundle viz", :ruby => "1.9.3", :if => Bundler.which("dot") do gem "rack-obama" G - bundle "viz", :env => { "RUBYOPT" => "-I #{graphviz_lib}" } + bundle! "viz" expect(out).to include("gem_graph.png") + + bundle! "viz", :format => :debug, :version => true + expect(out).to eq(strip_whitespace(<<-EOS).strip) + digraph Gemfile { + concentrate = "true"; + normalize = "true"; + nodesep = "0.55"; + edge[ weight = "2"]; + node[ fontname = "Arial, Helvetica, SansSerif"]; + edge[ fontname = "Arial, Helvetica, SansSerif" , fontsize = "12"]; + default [style = "filled", fillcolor = "#B9B9D5", shape = "box3d", fontsize = "16", label = "default"]; + rack [style = "filled", fillcolor = "#B9B9D5", label = "rack\\n1.3.pre"]; + default -> rack [constraint = "false"]; + "rack-obama" [style = "filled", fillcolor = "#B9B9D5", label = "rack-obama\\n1.0"]; + default -> "rack-obama" [constraint = "false"]; + "rack-obama" -> rack; + } + debugging bundle viz... + EOS end context "--without option" do @@ -44,7 +110,7 @@ describe "bundle viz", :ruby => "1.9.3", :if => Bundler.which("dot") do end G - bundle "viz --without=rails", :env => { "RUBYOPT" => "-I #{graphviz_lib}" } + bundle! "viz --without=rails" expect(out).to include("gem_graph.png") end @@ -62,7 +128,7 @@ describe "bundle viz", :ruby => "1.9.3", :if => Bundler.which("dot") do end G - bundle "viz --without=rails:rack", :env => { "RUBYOPT" => "-I #{graphviz_lib}" } + bundle! "viz --without=rails:rack" expect(out).to include("gem_graph.png") end end |