Sha256: fcb3aa27fd44fa3fadd6e95e08cb65c845e500019c90799a021d4ecafb91f95f

Contents?: true

Size: 843 Bytes

Versions: 2

Compression:

Stored size: 843 Bytes

Contents

require 'spec_helper'

describe Spree::UserRegistrationsController, :type => :controller do
  before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }

  context "#create" do
    it "should add referral_code param" do
      code = 'referral-code'
      session[:referral] = code
      spree_post :create, { spree_user: { email: 'foobar@example.com', password: 'foobar123', password_confirmation: 'foobar123' } }
      expect(controller.params[:spree_user][:referral_code]).to eql(code)
    end
    it "should add affiliate_code param" do
      code = 'affiliate-code'
      session[:affiliate] = code
      spree_post :create, { spree_user: { email: 'foobar@example.com', password: 'foobar123', password_confirmation: 'foobar123' } }
      expect(controller.params[:spree_user][:affiliate_code]).to eql(code)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_reffiliate-2.4.1 spec/controllers/spree/user_controller_spec.rb
spree_reffiliate-2.3.1 spec/controllers/spree/user_controller_spec.rb