Sha256: 92c28815b6e24e89b0ec26ece771aed14e7a62adde3711a4be3f961e7da3a2f2

Contents?: true

Size: 821 Bytes

Versions: 12

Compression:

Stored size: 821 Bytes

Contents

require 'spec_helper'

class Danica::Operator::Dummy < Danica::Operator
  variables :a, :b
end

describe Danica::Operator do
  let(:variables) { [2, 4] }
  let(:clazz) { described_class::Dummy }
  subject { clazz.new(*variables) }

  describe 'variables assignment' do
    it 'assignes the variables tpo its places' do
      expect(subject.a).to eq(Danica::Wrapper::Number.new(2))
      expect(subject.b).to eq(Danica::Wrapper::Number.new(4))
    end

    context 'when initializing with a hash' do
      let(:variables) { [{ name: :A, value: 2 }, { name: :B, value: 4 }] }

      it 'assignes the variables tpo its places' do
        expect(subject.a).to eq(Danica::Wrapper::Variable.new(name: :A, value: 2))
        expect(subject.b).to eq(Danica::Wrapper::Variable.new(name: :B, value: 4))
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
danica-2.6.4 spec/lib/danica/operator_spec.rb
danica-2.6.3 spec/lib/danica/operator_spec.rb
danica-2.6.2 spec/lib/danica/operator_spec.rb
danica-2.6.1 spec/lib/danica/operator_spec.rb
danica-2.6.0 spec/lib/danica/operator_spec.rb
danica-2.5.1 spec/lib/danica/operator_spec.rb
danica-2.5.0 spec/lib/danica/operator_spec.rb
danica-2.4.4 spec/lib/danica/operator_spec.rb
danica-2.4.3 spec/lib/danica/operator_spec.rb
danica-2.4.2 spec/lib/danica/operator_spec.rb
danica-2.4.1 spec/lib/danica/operator_spec.rb
danica-2.4.0 spec/lib/danica/operator_spec.rb