Sha256: a5182e858df5a43c20cdfa2d2a0cc5fb019ea6289e537fec617906563cee10ac

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Zertico::Interactor do
  let(:interactor) { Zertico::Interactor.new }

  describe '#perform' do
    it 'should raise a rollback exception' do
      expect { interactor.perform({}) }.to raise_error
    end
  end

  describe '#rollback' do
    it 'should return true' do
      expect(interactor.rollback).to eq(true)
    end
  end

  describe '#inject_instances' do
    before :each do
      interactor.inject_instances({ 'a' => 'B' })
    end

    it 'should create instances based on a hash' do
      expect(interactor.instance_variable_get('@a')).to eq('B')
    end
  end

  describe '#get_instances' do
    before :each do
      interactor.instance_variable_set('@a', 'A')
      interactor.instance_variable_set('@b', 'B')
      interactor.instance_variable_set('@z', 'Z')
    end

    it 'should return a hash with all instance variables name and value' do
      expect(interactor.get_instances).to eq({ 'a' => 'A', 'b' => 'B', 'z' => 'Z' })
    end
  end

  describe '.interface_name' do
    it 'should return the interface name' do
      expect(Zertico::Interactor.interface_name).to eq('Zertico')
    end
  end

  describe '#fail' do
    it 'should raise a rollback exception' do
      expect { interactor.fail! }.to raise_error
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zertico-2.0.0.beta.1 spec/zertico/interactor_spec.rb
zertico-2.0.0.alpha.3 spec/zertico/interactor_spec.rb
zertico-2.0.0.alpha.2 spec/zertico/interactor_spec.rb
zertico-2.0.0.alpha.1 spec/zertico/interactor_spec.rb