Sha256: 376e6def41ce6e2a6414698f5c7a430dbc8fdcdaa7aaf064fd406544aeb42d2d

Contents?: true

Size: 1.44 KB

Versions: 65

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'
require 'haml'

describe 'pugin/components/_status.html.haml', type: :view do

  it 'renders an ordered list when :ordered? is set to true' do 
    render partial: 'pugin/elements/list', locals: { ordered?: true, data: {} }
    expect(response).to include('<ol class="list--block">')
  end

  it 'renders an unordered list when :ordered? is not set' do 
    render partial: 'pugin/elements/list', locals: { data: {} }
    expect(response).to include('<ul class="list--block">')
  end

  context 'without any data' do 
    it 'renders a no content message when there is no data' do 
      render partial: 'pugin/elements/list', locals: { data: {} }
      expect(response).to include("There are no results")
    end
  end

  context 'with data' do 

    before :each do
      constituency = Class.new 
      allow(constituency).to receive(:current?).and_return(false)
      allow(constituency).to receive(:name).and_return('Aberavon')
      allow(constituency).to receive(:graph_id).and_return('123')
      allow(constituency).to receive(:start_date).and_return(DateTime.new(1929))
      allow(constituency).to receive(:end_date).and_return(DateTime.new(1950))
      @constituencies = [constituency]
    end

    it 'renders an internal partial if there is data' do 
      render partial: 'pugin/elements/list', locals: { item_type: "constituencies", data: @constituencies }
      expect(response).to include("Former constituency")
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
pugin-1.10.10 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.9 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.8 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.7 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.6 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.5 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.4 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.3 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.2 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.1 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.10.0 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.9.7 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.9.6 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.9.5 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.9.4 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.9.3 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.9.2 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.9.1 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.9.0 spec/views/pugin/elements/_list.html.haml_spec.rb
pugin-1.8.9 spec/views/pugin/elements/_list.html.haml_spec.rb