Sha256: f04522859d069d3988d4face65d5fdcfd9c5f18ef73e530da04f141ddbd04aa7

Contents?: true

Size: 771 Bytes

Versions: 6

Compression:

Stored size: 771 Bytes

Contents

require 'spec_helper'

describe 'users/index.html.erb', type: :view do
  let(:join_date) { 5.days.ago }
  before do
    users = []
    (1..25).each { |i| users << stub_model(User, name: "name#{i}", user_key: "user#{i}", created_at: join_date) }
    allow(User).to receive_message_chain(:all).and_return(users)
    relation = User.all
    allow(relation).to receive(:limit_value).and_return(10)
    allow(relation).to receive(:current_page).and_return(1)
    allow(relation).to receive(:total_pages).and_return(3)
    assign(:users, relation)
  end

  it "draws user list" do
    render
    page = Capybara::Node::Simple.new(rendered)
    expect(page).to have_content("Sufia Users")
    (1..10).each do |i|
      expect(page).to have_content("user#{i}")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sufia-6.7.0 spec/views/users/index.html.erb_spec.rb
sufia-6.6.1 spec/views/users/index.html.erb_spec.rb
sufia-6.6.0 spec/views/users/index.html.erb_spec.rb
sufia-6.5.0 spec/views/users/index.html.erb_spec.rb
sufia-6.4.0 spec/views/users/index.html.erb_spec.rb
sufia-6.3.0 spec/views/users/index.html.erb_spec.rb