spec/lxc_spec.rb in lxc-ruby-0.3.1 vs spec/lxc_spec.rb in lxc-ruby-0.3.2

- old
+ new

@@ -68,26 +68,37 @@ expect(c).to be_a LXC::Container expect(c.name).to eq('foo') end end - describe '.containers' do - it 'returns all available containers' do + describe ".containers" do + it "returns all available containers" do stub_lxc('ls') { "vm0\nvm1\nvm0" } list = LXC.containers expect(list).to be_an Array expect(list.size).to eq(2) expect(list.first).to be_a LXC::Container expect(list.first.name).to eq('vm0') end - context 'with argument' do - it 'returns containers filtered by name' do - stub_lxc('ls') { "vm0\nvm1\nfoo\n"} + context "with string filter" do + before do + stub_lxc("ls") { "vm0\nvm1\nfoo\n"} + end - list = LXC.containers("vm") - expect(list.size).to eq(2) + it "returns matched containers" do + expect(LXC.containers("vm").size).to eq 2 + end + end + + context "with regexp filter" do + before do + stub_lxc("ls") { "vm0\nvm1\nfoo\n"} + end + + it "returns matched container" do + expect(LXC.containers(/vm/).size).to eq 2 end end end describe '.sudo' do