Sha256: 06e2a6149ca3a10b3356a6355c53d8ee6477748cb6ccbb6cbcf11ce3cfe3e110

Contents?: true

Size: 1.19 KB

Versions: 9

Compression:

Stored size: 1.19 KB

Contents

require 'minitest_helper'

module SlideHero
  describe Code do
    it "takes an optional base path of where to look for files" do
      code = Code.new(:ruby, File.join(Dir.pwd,"test","fixtures")) do
        "testclass.rb"
      end
      code.location.must_equal(File.join(Dir.pwd,"test","fixtures","code", "testclass.rb"))
    end
    it "exposes language from initialization value" do
      code = Code.new(:ruby, File.join(Dir.pwd,"test","fixtures")) do
        "testclass.rb"
      end
      code.language.must_equal :ruby
    end

    it "exposes source from initialization value" do
      code = Code.new(:ruby, File.join(Dir.pwd,"test","fixtures")) do
        "testclass.rb"
      end
      code.source.must_include "class Working" 
    end

    it "formats code properly" do
      code = Code.new(:ruby, File.join(Dir.pwd,"test","fixtures")) do
        "testclass.rb"
      end

      code.compile.strip.must_equal  '<pre><code data-trim class="ruby">
  class Working
  def some_method
    "woot!"
  end
end

</code></pre>'
    end

    it "exits if file is not found" do

      lambda do
        code = Code.new(:ruby) do
          "dont_exists.rb"
        end
      end.must_raise SystemExit
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
slide_hero-0.0.11 test/slide_hero/code_spec.rb
slide_hero-0.0.10 test/slide_hero/code_spec.rb
slide_hero-0.0.9 test/slide_hero/code_spec.rb
slide_hero-0.0.8 test/slide_hero/code_spec.rb
slide_hero-0.0.7 test/slide_hero/code_spec.rb
slide_hero-0.0.6 test/slide_hero/code_spec.rb
slide_hero-0.0.5 test/slide_hero/code_spec.rb
slide_hero-0.0.4 test/slide_hero/code_spec.rb
slide_hero-0.0.3 test/slide_hero/code_spec.rb