Sha256: f6454a67ad65e625ea80e662c1364907dbdf52d3a835e4d6e5ad61d7768cb2a5

Contents?: true

Size: 1.24 KB

Versions: 8

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'

module Locomotive
  module Plugin
    describe ConfigUI do

      before(:each) do
        @config = {}
        @plugin = MyPlugin.new(@config)
        @plugin_with_non_string_path = PluginWithNonStringPath.new(@config)
        @another_plugin = MyOtherPlugin.new(@config)
        @useless_plugin = UselessPlugin.new(@config)
      end

      it 'should return the template string of an HTML file' do
        @plugin = MyPlugin.new({})
        filepath = @plugin.config_template_file
        @plugin.config_template_string.should == IO.read(filepath)
      end

      it 'should handle non-string paths' do
        filepath = @plugin_with_non_string_path.config_template_file
        template = @plugin_with_non_string_path.config_template_string
        template.should == IO.read(filepath.to_s)
      end

      it 'should return nil for the template string if no file is specified' do
        @useless_plugin.config_template_string.should be_nil
      end

      it 'should compile the template string for a HAML file' do
        filepath = @another_plugin.config_template_file
        haml = IO.read(filepath)
        html = Haml::Engine.new(haml).render
        @another_plugin.config_template_string.should == html
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotive_plugins-1.0.0.beta9 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.0.0.beta8 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.0.0.beta7 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.0.0.beta6 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.0.0.beta5 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.0.0.beta4 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.0.0.beta3 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.0.0.beta2 spec/lib/locomotive/plugin/config_ui_spec.rb