Sha256: a9669ede4f189362c49827c5441104a2a695d9363c2238b67c32f0372c3f1a48
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
RSpec.describe 'app_kit/resources/index.html.slim', :type => :view do let(:resource) { AppKit::Resource.find(:invoice) } before(:each) do allow(view).to receive(:resource).and_return(resource) view.extend AppKit::PathHelper view.extend AppKit::FilterHelper view.extend AppKit::AttributeHelper view.extend AppKit::ResourceHelper view.extend AppKit::TableHelper end context "with data" do before(:each) do FactoryGirl.create(:invoice) assign(:records, Invoice.all.page(1)) end it "should display table" do render expect(rendered).to have_selector('table') end it "should render table row for each record" do FactoryGirl.create_list(:invoice_published, 5) FactoryGirl.create_list(:invoice_paid, 5) assign(:records, Invoice.open.page(1)) render expect(rendered).to have_selector('table tbody tr', count: 5) end end context "without data" do before(:each) do assign(:records, Invoice.all.page(0)) end it "should not render table" do render expect(rendered).to_not have_selector("table") end end it "should show new button" do assign(:records, Invoice.all.page(0)) render expect(rendered).to have_selector("a", text: 'New Invoice') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
app_kit-0.0.2 | spec/views/app_kit/resources/index.html.slim_spec.rb |
app_kit-0.0.1 | spec/views/app_kit/resources/index.html.slim_spec.rb |