Skip to content

Commit

Permalink
Automatically load configuration from config/tinymce.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
spohlenz committed Feb 22, 2012
1 parent 90ba031 commit 604247d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tinymce/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module TinyMCE
def self.configuration
Configuration.new(Configuration.defaults)
@configuration ||= Configuration.load(Rails.root.join("config/tinymce.yml"))
end

def self.base
Expand Down
14 changes: 14 additions & 0 deletions sandbox/config/tinymce.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
theme_advanced_toolbar_location: top
theme_advanced_toolbar_align: left
theme_advanced_statusbar_location: bottom
theme_advanced_buttons3_add:
- tablecontrols
- fullscreen

plugins:
- inlinepopups
- paste
- table
- fullscreen

dialog_type: "modal"
9 changes: 9 additions & 0 deletions spec/lib/tinymce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,13 @@
TinyMCE.base.should eq("/subfolder/assets/tinymce")
end
end

describe ".configuration" do
let(:configuration) { stub }

it "loads the tinymce.yml config file" do
TinyMCE::Configuration.should_receive(:load).with(Rails.root.join("config/tinymce.yml")).and_return(configuration)
TinyMCE.configuration.should eq(configuration)
end
end
end

0 comments on commit 604247d

Please sign in to comment.