Skip to content

Fix devise specs for :devise_scope compatibility#2311

Merged
mshibuya merged 1 commit into
railsadminteam:masterfrom
diowa:fix-devise-specs
May 28, 2015
Merged

Fix devise specs for :devise_scope compatibility#2311
mshibuya merged 1 commit into
railsadminteam:masterfrom
diowa:fix-devise-specs

Conversation

@tagliala
Copy link
Copy Markdown
Contributor

Devise 3.5.1 allows objects to specify their devise scope heartcombo/devise@4837bb0

So if we add allow_any_instance_of(User).to receive(:respond_to?).and_return(true) this will respond true here: https://github.com/plataformatec/devise/blob/4837bb0a4e5a1ea00e732f48ee2acef90606a31e/lib/devise/mapping.rb#L34

and the specs will fail.

Moreover, afaik, respond_to? should answer with true or false and this spec

    it 'does not cause error when email is nil' do
      allow_any_instance_of(User).to receive(:respond_to?).and_return(true)
      allow_any_instance_of(User).to receive(:respond_to?).with(:email).and_return(nil)

is doing something else. I think it was supposed to allow_any_instance_of(User).to receive(:email).and_return(nil)

mshibuya added a commit that referenced this pull request May 28, 2015
Fix devise specs for :devise_scope compatibility
@mshibuya mshibuya merged commit dcb774d into railsadminteam:master May 28, 2015
@mshibuya
Copy link
Copy Markdown
Member

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants