Sha256: 75155feed1bd8bb4787cde7d7d668a2641b42823f5ae5fff40a8f743190605a1

Contents?: true

Size: 841 Bytes

Versions: 11

Compression:

Stored size: 841 Bytes

Contents

require "spec_helper"

RSpec.describe JoyUssdEngine::DataTransformer do



  it "saves the context object" do
    expect(@transformer_context).to eq(nil)
  end

  it "returns false when calling the appterminator method" do
    expect(@transformer_context).to eq(@context)
  end

  it 'transforms an incoming request params' do
    params = { Message: "hello", phone: "+233578876155" }
    allow(@data_transformer).to receive(:request_params).with(params).and_return({message: params[:Message], session_id: params[:phone]})
    expect(@data_transformer.request_params(params)).to eq({message: "hello", session_id: "+233578876155"})
  end

  it 'returns false when app_terminator is called' do
    allow(@data_transformer).to receive(:app_terminator).and_call_original
    expect(@data_transformer.app_terminator({})).to eq(false)
  end
  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
joy_ussd_engine-0.1.14 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.13 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.12 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.11 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.10 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.9 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.8 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.7 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.6 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.5 spec/joy_ussd_engine_transformer.spec
joy_ussd_engine-0.1.3 spec/joy_ussd_engine_transformer.spec