Sha256: cd6bc7951c24e40d7af453d1f74c9d1ffb600816f11d6cba4ba6d49775dd54a5
Contents?: true
Size: 1011 Bytes
Versions: 4
Compression:
Stored size: 1011 Bytes
Contents
require 'spec_helper' describe TP::Slide::Code do subject { slide } let(:markdown) { "# Code\n\n```rb\nclass Thing\nend\n```" } let(:slide) { klass.new markdown } before do Screen.stub width: 20 end its(:width) { should == 11 } its(:height) { should == 4 } its(:code) { should == "class Thing\nend\n" } its(:language) { should == "ruby" } describe "#highlighted_code" do subject(:highlighted_code) { slide.highlighted_code } it "uses CodeRay" do CodeRay.should_receive(:encode).with("class Thing\nend\n", "ruby", :terminal) highlighted_code end context "with no language" do let(:markdown) { "# Code\n\n```\nThis is a code block\n```" } it "doesn't raise an error" do highlighted_code end end end describe "#render" do subject(:render) { slide.render } before do slide.stub highlighted_code: "Highlighted code" end it { should == "Code".center(20) + "\n\n" + "Highlighted code" } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tp-0.5.1 | spec/lib/tp/slide/code_spec.rb |
tp-0.5.0 | spec/lib/tp/slide/code_spec.rb |
tp-0.4.1 | spec/lib/tp/slide/code_spec.rb |
tp-0.4.0 | spec/lib/tp/slide/code_spec.rb |