Sha256: 8fd3d37d548f12f87e39d825e26225c7c3e954ece6040bd437a1ce689757fd23

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe <%= class_name %> do
  subject { <%= class_name %>.new(params) }
  let(:params) {
    {
      :job_id => '1234',
      :one_time_notification_key => 'abc',
      :job_status => 'ok',
      :notification_payload => expected_notification_payload
    }
  }
  let(:expected_notification_payload) { {:hello => 'world'} }

  describe 'standard behavior' do
    it 'should have #job_id' do
      subject.job_id.should == params.fetch(:job_id).to_i
    end
    it 'should have #job_status' do
      subject.job_status.should == params.fetch(:job_status).to_sym
    end
    it 'should have #notification_payload' do
      subject.notification_payload.should == params.
        fetch(:notification_payload).to_sym
    end
    it 'should behave as a the :notification_payload hash' do
      subject[:hello].should == params[:notification_payload][:hello]
      subject['hello'].should == params[:notification_payload][:hello]
      subject.fetch(:hello).should == params[:notification_payload][:hello]
      subject.fetch('hello').should == params[:notification_payload][:hello]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heracles-wrapper-0.0.3 lib/rails/generators/heracles/wrapper/notification_response/templates/notification_response_spec.rb.erb