Sha256: cbbe29380aa39d339b80f1f8d6f9c906c1f5188eb94726348bc3d8e2dd24168f

Contents?: true

Size: 1.72 KB

Versions: 4

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'
describe Qfill::Origin do
  context "#new" do
    context "with no arguments" do
      it "should raise ArgumentError" do
       expect { Qfill::Origin.new() }.to raise_error(ArgumentError)
      end
    end
    context "with name" do
      before :each do
        @arguments = { :name => "High List" }
      end
      it "should not raise any errors" do
        expect { Qfill::Origin.new(@arguments) }.to_not raise_error
      end
      it "should instantiate with name" do
        Qfill::Origin.new(@arguments).name.should == 'High List'
      end
    end
    context "with elements" do
      before :each do
        @arguments = {  :name => "High List",
                        :elements => [1,2] }
      end
      it "should instantiate with elements" do
        Qfill::Origin.new(@arguments).elements.should == [1,2]
      end
    end
    context "with backfill" do
      before :each do
        @arguments = {  :name => "High List",
                        :elements => [1, 2],
                        :backfill => "Medium List" }
      end
      it "should instantiate with elements" do
        Qfill::Origin.new(@arguments).backfill.should == 'Medium List'
      end
    end
    context "with filter" do
      before :each do
        lambda = -> (object) { !object.nil? }
        @filter = Qfill::Filter.new(lambda)
        @arguments = {  :name => "High List",
                        :elements => [1, 2],
                        :backfill => "Medium List",
                        :filter => @filter }
      end
      it "should instantiate with processor" do
        Qfill::Origin.new(@arguments).filter.should be_a(Qfill::Filter)
        Qfill::Origin.new(@arguments).filter.should == @filter
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
qfill-0.0.4 spec/qfill/origin_spec.rb
qfill-0.0.3 spec/qfill/origin_spec.rb
qfill-0.0.2 spec/qfill/origin_spec.rb
qfill-0.0.1 spec/qfill/origin_spec.rb