Sha256: 6f3a87e67a2d50d3076cd2e98977a3b9c76049821dc02fa21b1474af2c400a60

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

shared_examples_for "An operator class" do

  it "should not have public _each and _prepare methods" do
    operator_class.public_method_defined?(:_each).should be_false
    operator_class.public_method_defined?(:_prepare).should be_false
  end

  it "should have a public run method" do
    operator_class.public_method_defined?(:run).should be_true
  end
  
  it "should have a public pipe method" do
    operator_class.public_method_defined?(:pipe).should be_true
  end

  it "should have a public each method" do
    operator_class.public_method_defined?(:each).should be_true
  end
  
  it "should have a unary? class method" do
    operator_class.should respond_to(:unary?)
  end

  it "should have a binary? class method" do
    operator_class.should respond_to(:binary?)
  end
  
  it "should have a nullary? class method" do
    operator_class.should respond_to(:nullary?)
  end
  
  it "should implement unary? and binary? accurately" do
    op = operator_class
    (op.nullary? || op.unary? || op.binary?).should be_true
    (op.nullary? && op.unary?).should be_false
    (op.nullary? && op.binary?).should be_false
    (op.unary? && op.binary?).should be_false
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alf-0.10.1 spec/shared/an_operator_class.rb
alf-0.10.0 spec/shared/an_operator_class.rb