diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-09-20 17:18:23 +0100 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-09-28 13:29:32 +0100 |
commit | 5629d468782d1c414d33c8221467c06b13cb9b66 (patch) | |
tree | fa94b0731c8f64e8d5188c53e9cbd9f523a9b6bb /spec/views | |
parent | 38c7229156aae6d5635a1a1ac5851563d2a8989d (diff) | |
download | gitlab-ce-5629d468782d1c414d33c8221467c06b13cb9b66.tar.gz |
Finish _participants view spec
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/shared/issuable/_participants.html.haml.rb | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/spec/views/shared/issuable/_participants.html.haml.rb b/spec/views/shared/issuable/_participants.html.haml.rb index 6bc95846f63..0a123e83e2e 100644 --- a/spec/views/shared/issuable/_participants.html.haml.rb +++ b/spec/views/shared/issuable/_participants.html.haml.rb @@ -1,41 +1,26 @@ require 'spec_helper' require 'nokogiri' -def expect_lazy_load_image(author) - avatar = author.find('img') - - expect(avatar[:src]).to eql?('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==') - expect(avatar[:"data-src"]).to exist -end - describe 'shared/issuable/_participants.html.haml' do let(:project) { create(:project) } - let(:participants) { create_list(:user, 10) } + let(:participants) { create_list(:user, 100) } before do allow(view).to receive_messages(project: project, participants: participants) end - it 'displays' do + it 'renders lazy loaded avatars' do render 'shared/issuable/participants' html = Nokogiri::HTML(rendered) - authors = html.css('.participants-author') - p authors - p authors.size - visible_authors = authors[0..6] - hidden_authors = authors[7..-1] - - visible_authors.each do |author| - expect(author).not_to have_selector('js-participants-hidden') - expect_lazy_load_image(author) - end + avatars = html.css('.participants-author img') - hidden_authors.each do |author| - expect(author).to have_selector('js-participants-hidden') - expect_lazy_load_image(author) + avatars.each do |avatar| + expect(avatar[:class]).to include('lazy') + expect(avatar[:src]).to eql('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==') + expect(avatar[:"data-src"]).to match('http://www.gravatar.com/avatar/') end end end |