Sha256: a2d7be1c852d13a2ade69762af81123a0d6d14798981fd82b0a87accfd2b3a8e
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require 'spec_helper' module Viiite class Command describe Commons, "#single_source" do let(:commons){ Object.new.extend(Commons). extend(Module.new{ attr_accessor :requester }) } subject{ commons.single_source(argv) } describe "with an empty argv" do let(:argv){ [] } it{ should be_a(Alf::Reader) } end describe "with an argv with more than one arg" do let(:argv){ [1, 2, 3] } specify{ lambda{subject}.should raise_error(Quickl::InvalidArgument) } end describe "with a argv with one existing file" do let(:argv){ [ File.expand_path("../existing.rash", __FILE__) ] } it{ should be_a(Alf::Reader) } specify{ subject.to_a.should eq([{:name => 'existing'}]) } end describe "with a argv with a benchmark name but no requester" do let(:argv){ [ :hello ] } specify{ lambda{subject}.should raise_error(Quickl::InvalidArgument) } end describe 'with a argv and a requester' do let(:argv){ [ :hello ] } let(:requester){ Object.new.extend Module.new{ def bdb; self; end def dataset(name); name.to_s.upcase; end } } before{ commons.requester = requester } describe "with a block" do subject{ commons.single_source(argv){|*args| args} } it{ should eq([requester, :hello]) } end describe "without block" do it{ should eq("HELLO") } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
viiite-0.2.0 | spec/unit/command/commons/test_single_source.rb |