Sha256: 277781f5b85da9f9d59b04d9bf7b95ef5f3591a2660c7beaddd461a1b64b78a9

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

require "spec_helper"

describe ThemesOnRails::ActionController do
  let(:controller)        { controller_class.new }
  let(:controller_class)  { Class.new }

  it "initializes with theme as string" do
    action_controller = ThemesOnRails::ActionController.new(controller, "theme_a")

    expect(action_controller.theme_name).to eq("theme_a")
  end

  it "initializes with theme as symbol method" do
    def controller.theme_resolver
      "theme_a"
    end
    action_controller = ThemesOnRails::ActionController.new(controller, :theme_resolver)

    expect(action_controller.theme_name).to eq("theme_a")
  end

  it "initializes with theme as symbol" do
    action_controller = ThemesOnRails::ActionController.new(controller, :theme_a)

    expect(action_controller.theme_name).to eq("theme_a")
  end

  it "initializes with theme as proc or lambda" do
    action_controller = ThemesOnRails::ActionController.new(controller, lambda { |con| "theme_a" })

    expect(action_controller.theme_name).to eq("theme_a")
  end

  it "initializes with theme as nil" do
    expect {
      ThemesOnRails::ActionController.new(controller, nil)
    }.to raise_error(ArgumentError)
  end

  it "#theme_view_path" do
    action_controller = ThemesOnRails::ActionController.new(controller, "theme_a")

    expect(action_controller.theme_view_path).to eq("#{Rails.root}/app/themes/theme_a/views")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
themes_on_rails-0.4.0 spec/lib/action_controller_spec.rb
themes_on_rails-0.3.1 spec/lib/action_controller_spec.rb
themes_on_rails-0.3.0 spec/lib/action_controller_spec.rb