Sha256: 2876a3e7e9bb182ad9795186cece8b086038487eecb0abfd68138f97c8ccf7e0
Contents?: true
Size: 1.86 KB
Versions: 4
Compression:
Stored size: 1.86 KB
Contents
require 'spec_helper' describe PersonalReportHelper do describe "#personal_reports" do it 'renders correctly' do report_stub = stub(name: 'Daily', type: :week, data_path: '/data.json', download_path: '/data.csv') helper_stub = stub(reports: [report_stub]) html = helper.personal_reports(helper_stub) page = Capybara::Node::Simple.new(html) page.find('#reports_nav li:first-child').text.should eq(report_stub.name) page.find('#reports_data .report-download a')[:href].should eq(report_stub.download_path) end end describe "#personal_report_legend" do it 'renders correctly' do helper_stub = ['1-2', '3-4', '5+'] html = helper.personal_report_legend(helper_stub) page = Capybara::Node::Simple.new(html) page.find('.legend span:nth-child(1)')[:class].should eq('badge badge-error') page.find('.legend span:nth-child(1)').text.should eq(I18n.t('woople_theme.reports.legend.viewed', range: helper_stub[0])) page.find('.legend span:nth-child(2)')[:class].should eq('badge badge-warning') page.find('.legend span:nth-child(2)').text.should eq(I18n.t('woople_theme.reports.legend.viewed', range: helper_stub[1])) page.find('.legend span:nth-child(3)')[:class].should eq('badge badge-success') page.find('.legend span:nth-child(3)').text.should eq(I18n.t('woople_theme.reports.legend.viewed', range: helper_stub[2])) end end describe "#personal_report_download" do it 'renders correctly' do path = 'http://example.com' html = helper.personal_report_download(path) page = Capybara::Node::Simple.new(html) page.find('a')[:href].should eq(path) page.find('a').text.should eq(" Download") end it 'returns nil when a link is not provided' do path = nil html = helper.personal_report_download(path) html.should be_nil end end end
Version data entries
4 entries across 4 versions & 1 rubygems