Sha256: c3f3c72adf3a15eb1cf8cccba12bba8c0d16634c4d66bf1d6d7b548632153dec

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

module Locomotive
  module Plugin
    describe ConfigUI do

      before(:each) do
        @config = {}

        @plugin = MyPlugin.new
        @plugin.config = @config

        @plugin_with_non_string_path = PluginWithNonStringPath.new
        @plugin_with_non_string_path.config = @config

        @another_plugin = MyOtherPlugin.new
        @another_plugin.config = @config

        @useless_plugin = UselessPlugin.new
        @useless_plugin.config = @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

5 entries across 5 versions & 1 rubygems

Version Path
locomotive_plugins-1.2.0 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.1.1 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.1.0 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.0.1 spec/lib/locomotive/plugin/config_ui_spec.rb
locomotive_plugins-1.0.0.beta10 spec/lib/locomotive/plugin/config_ui_spec.rb