BVB Source Codes

hologram Show template_spec.rb Source code

Return Download hologram: download template_spec.rb Source code - Download hologram Source code - Type:.rb
  1. require 'spec_helper'
  2.  
  3. describe Hologram::CodeExampleRenderer::Template do
  4.   describe '#template' do
  5.     subject { described_class.new(template_name).template }
  6.  
  7.     context 'when template_name is nil' do
  8.       let(:template_name) { nil }
  9.       it { is_expected.to be_nil }
  10.     end
  11.  
  12.     context 'when template_name is not nil' do
  13.       let(:template_name) { 'bar' }
  14.  
  15.       let(:custom_template_filename) { 'custom/bar.html.erb' }
  16.       let(:default_template_filename) { 'cwd/../../template/code_example_templates/bar.html.erb' }
  17.  
  18.       before do
  19.         allow(File).to receive(:dirname) { 'cwd/' }
  20.         allow(File).to receive(:read).with(custom_template_filename) { 'custom template' }
  21.         allow(File).to receive(:read).with(default_template_filename) { 'default template' }
  22.       end
  23.  
  24.       context 'when path_to_custom_example_templates is defined' do
  25.         before do
  26.           described_class.path_to_custom_example_templates = 'custom/'
  27.           allow(File).to receive(:file?).with(custom_template_filename) { has_custom_template? }
  28.         end
  29.  
  30.         after do
  31.           described_class.path_to_custom_example_templates = nil
  32.         end
  33.  
  34.         context 'when a custom template exists' do
  35.           let(:has_custom_template?) { true }
  36.           it { is_expected.to eq 'custom template' }
  37.         end
  38.  
  39.         context 'when a custom template does not exist' do
  40.           let(:has_custom_template?) { false }
  41.           it { is_expected.to eq 'default template' }
  42.         end
  43.       end
  44.  
  45.       context 'when a path_to_custom_example_templates is not defined' do
  46.         it { is_expected.to eq 'default template' }
  47.       end
  48.     end
  49.   end
  50. end
  51.  
downloadtemplate_spec.rb Source code - Download hologram Source code
Related Source Codes/Software:
www.html5rocks.com - ....a top-notch resource for web developer 2017-05-12
MTStatusBarOverlay - A custom iOS status bar overlay seen in Apps like ... 2017-05-12
blueprint - Reverse engineer server configuration ... 2017-05-12
PullToRefresh - A simple iPhone TableViewController for adding the... 2017-05-12
mrjob - Run MapReduce jobs on Hadoop or Amazon Web Service... 2017-05-11
isso - a Disqus alternative https:... 2017-05-12
python3-cookbook - "The Python Cookbook" 3 rd Edition Translatio 2017-05-12
TSA-Travel-Sentry-master-keys - 3D reproduction of TSA Master key 2017-05-12
fatfree - A powerful yet easy-to-use PHP micro-framework des... 2017-05-13
rolify - Role management library with the resource scoping 2017-05-13
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top