spec/dsl/with_server_spec.rb in eye-0.2.1 vs spec/dsl/with_server_spec.rb in eye-0.2.2

- old
+ new

@@ -36,10 +36,32 @@ E Eye::Dsl.parse_apps(conf).should == {"bla"=>{:name => "bla", :groups=>{"__default__"=>{:name => "__default__", :application => "bla", :processes=>{"1"=>{:pid_file=>"1.pid", :application=>"bla", :group=>"__default__", :name=>"1"}}}}}} end + it "should behaves like scoped" do + stub(Eye::System).host{ "server1" } + + conf = <<-E + Eye.application("bla") do + env "A" => "B" + with_server /server1/ do + env "A" => "C" + group(:a){} + end + + group(:b){} + end + E + + Eye::Dsl.parse_apps(conf).should == { + "bla" => {:name=>"bla", :environment=>{"A"=>"B"}, + :groups=>{ + "a"=>{:name=>"a", :environment=>{"A"=>"C"}, :application=>"bla", :processes=>{}}, + "b"=>{:name=>"b", :environment=>{"A"=>"B"}, :application=>"bla", :processes=>{}}}}} + end + describe "matches" do subject{ Eye::Dsl::Opts.new } it "match string" do stub(Eye::System).host{ "server1" } @@ -78,14 +100,16 @@ Eye::System.host = 'mega_server' conf = <<-E Eye.application("bla"){ with_server('mega_server') do - working_dir "/tmp" + group :blo do + working_dir "/tmp" + end end } E - Eye::Dsl.parse_apps(conf).should == {"bla" => {:working_dir=>"/tmp", :name => "bla"}} + Eye::Dsl.parse_apps(conf).should == {"bla" => {:name=>"bla", :groups=>{"blo"=>{:name=>"blo", :application=>"bla", :working_dir=>"/tmp", :processes=>{}}}}} end it "hostname work" do Eye::System.host = 'supa_server' \ No newline at end of file