Sha256: cbe6e75d3df45520f30ac57d174a2e2ca44338ac62822e2d5558aa326c2e2354

Contents?: true

Size: 979 Bytes

Versions: 11

Compression:

Stored size: 979 Bytes

Contents

# frozen_string_literal: true

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Stealth::ServiceReply" do

  describe "nested reply with ERB" do
    let(:recipient_id) { "8b3e0a3c-62f1-401e-8b0f-615c9d256b1f" }
    let(:yaml_reply) { File.read(File.join(File.dirname(__FILE__), 'replies', 'nested_reply_with_erb.yml')) }

    it "should load all the replies" do
      first_name = "Presley"

      service_reply = Stealth::ServiceReply.new(
        recipient_id: recipient_id,
        yaml_reply: yaml_reply,
        context: binding
      )

      expect(service_reply.replies.size).to eq 5
    end

    it "should raise Stealth::Errors::UndefinedVariable when local variable is not available" do
      expect {
        service_reply = Stealth::ServiceReply.new(
          recipient_id: recipient_id,
          yaml_reply: yaml_reply,
          context: binding
        )
      }.to raise_error(Stealth::Errors::UndefinedVariable)
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
stealth-0.10.2 spec/service_reply_spec.rb
stealth-0.10.1 spec/service_reply_spec.rb
stealth-0.10.0 spec/service_reply_spec.rb
stealth-0.9.8 spec/service_reply_spec.rb
stealth-0.9.7 spec/service_reply_spec.rb
stealth-0.9.6 spec/service_reply_spec.rb
stealth-0.9.5 spec/service_reply_spec.rb
stealth-0.9.4 spec/service_reply_spec.rb
stealth-0.9.3 spec/service_reply_spec.rb
stealth-0.9.2 spec/service_reply_spec.rb
stealth-0.9.1 spec/service_reply_spec.rb