require 'spec_helper'

describe SignupHint do

  let(:user) {AnonymousUser.new(SecureRandom.uuid, nil)}

  describe "refresh_by_anoymous_user" do
    it "creates" do
      hint = SignupHint.refresh_by_anoymous_user(user, {redirect_location: 'abc'})
      hint.errors.any?.should be_false
      hint.redirect_location.should eq('abc')
      hint.want_jamblaster.should be_false
    end

    it "updated" do
      SignupHint.refresh_by_anoymous_user(user, {redirect_location: 'abc'})

      hint = SignupHint.refresh_by_anoymous_user(user, {redirect_location: nil, want_jamblaster: true})
      hint.errors.any?.should be_false
      hint.redirect_location.should be_nil
      hint.want_jamblaster.should be_true
    end
  end
end
