Sha256: 226c708254ad1bfe05b7427fae0b8a7509e59faa4dd0c2746e3bcb8a93db6b5d
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require File.expand_path("spec_helper", File.dirname(File.dirname(__FILE__))) describe "shared_vars plugin" do it "adds shared method for sharing variables across multiple apps" do app(:shared_vars) {|r| shared[:c]} old_app = app app(:shared_vars) do |r| shared[:c] = 'c' r.run old_app end body.should == 'c' end it "adds shared with hash merges the hash into the shared vars" do app(:shared_vars) do |r| shared(:c=>'c') shared[:c] end body.should == 'c' end it "calling shared with hash and a block sets shared variables only for that block" do app(:shared_vars) do |r| c = nil d = nil shared[:c] = 'b' shared(:c=>'c', :d=>'d') do c = shared[:c] d = shared[:d] end "#{shared[:c]}:#{shared[:d]}:#{c}:#{d}" end body.should == 'b::c:d' end it "calling shared with no arguments and a block raises an error" do app(:shared_vars) do |r| shared{} end proc{body}.should raise_error(Roda::RodaError) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
roda-2.2.0 | spec/plugin/shared_vars_spec.rb |