Sha256: 1c0cac8b16d6ddc5b45b87c38e2fdb3236566e85da4c5d5e66816338c94bc19e

Contents?: true

Size: 674 Bytes

Versions: 45

Compression:

Stored size: 674 Bytes

Contents

require 'spec_helper'

describe User do

  describe "user_key" do
    let(:user) { User.new.tap {|u| u.email = "foo@example.com"} }
    before do
      allow(user).to receive(:username).and_return('foo')
    end

    it "should return email" do
      expect(user.user_key).to eq 'foo@example.com'
    end

    it "should return username" do
      allow(Devise).to receive(:authentication_keys).and_return([:username])
      expect(user.user_key).to eq 'foo'
    end

  end

end

module UserTestAttributes
  ['first_name','last_name','full_name','affiliation','photo'].each do |attr|
    class_eval <<-EOM
      def #{attr}
        "test_#{attr}"
      end
    EOM
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
hydra-core-8.2.0 spec/models/user_spec.rb
hydra-core-10.3.4 spec/models/user_spec.rb
hydra-core-10.3.3 spec/models/user_spec.rb
hydra-core-10.3.2 spec/models/user_spec.rb
hydra-core-10.3.0 spec/models/user_spec.rb
hydra-core-10.2.0 spec/models/user_spec.rb
hydra-core-10.1.0 spec/models/user_spec.rb
hydra-core-10.0.2 spec/models/user_spec.rb
hydra-core-10.0.1 spec/models/user_spec.rb
hydra-core-10.0.0 spec/models/user_spec.rb
hydra-core-10.0.0.beta4 spec/models/user_spec.rb
hydra-core-10.0.0.beta3 spec/models/user_spec.rb
hydra-core-10.0.0.beta2 spec/models/user_spec.rb
hydra-core-10.0.0.beta1 spec/models/user_spec.rb
hydra-core-9.10.0 spec/models/user_spec.rb
hydra-core-9.9.0 spec/models/user_spec.rb
hydra-core-9.8.1 spec/models/user_spec.rb
hydra-core-9.8.0 spec/models/user_spec.rb
hydra-core-9.7.1 spec/models/user_spec.rb
hydra-core-9.7.0 spec/models/user_spec.rb