localized 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- localized (0.0.1)
4
+ localized (0.0.2)
5
5
  rails (>= 3.0)
6
6
 
7
7
  GEM
data/lib/localized.rb CHANGED
@@ -8,7 +8,7 @@ require 'localized/helper'
8
8
 
9
9
  # load the modules into the rails world
10
10
  [
11
- ActionView::Helpers::UrlHelper,
11
+ ActionView::Base,
12
12
  ActionController::Base
13
13
  ].each { |mod| mod.send :include, Localized::Helper }
14
14
 
@@ -4,7 +4,8 @@ module Localized::Config
4
4
  def self.configuration
5
5
  @configuration ||= begin
6
6
  config_file = File.expand_path(File.join(Rails.root.to_s,'/config/localized.yml'))
7
- defaults = YAML.load_file('config/defaults.yml')
7
+ defaults_file = File.expand_path(File.join(__FILE__, '..', '..', '..', 'config/defaults.yml'))
8
+ defaults = YAML.load_file(defaults_file)
8
9
  custom = YAML.load_file(config_file) if File.exists?(config_file)
9
10
  symobolize_keys_and_values(defaults.merge(custom || {}))
10
11
  end.symbolize_keys
data/localized.gemspec CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.name = 'localized'
3
3
  s.author = 'Paul Hepworth'
4
4
  s.email = 'paul<dot>hepworth<at>peppyheppy<dot>com'
5
- s.version = '0.0.2'
5
+ s.version = '0.0.3'
6
6
  s.date = '2011-07-09'
7
7
  s.summary = "A ruby on rails gem that provides locale setting support through the subdomain (in a box)"
8
8
  s.description = "This gem allows you to set locale using a subdomain and url helper support for switching sites."
@@ -1,24 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- class FoobarController < ::ActionController::Base
4
- def test
5
- render :text => 'success'
6
- end
7
- end
8
-
9
3
  describe FoobarController , "locale specific routes", :type => :controller do
10
4
  before :all do
11
5
  Rails.stub(:root).and_return(Pathname.new(File.join(File.dirname(__FILE__),'..', '..')))
12
- Rails.application.routes.draw do
13
- get '/test' => 'foobar#test', :as => :test
14
- root :to => "foobar#test"
15
- end
16
- end
17
-
18
- after :all do
19
- silence_warnings do
20
- Rails.application.reload_routes!
21
- end
22
6
  end
23
7
 
24
8
  describe "sites and subdomain" do
data/spec/spec_helper.rb CHANGED
@@ -11,3 +11,14 @@ class Application < Rails::Application
11
11
  end
12
12
  Application.initialize!
13
13
 
14
+ class FoobarController < ::ActionController::Base
15
+ def test
16
+ render :text => 'success'
17
+ end
18
+ end
19
+
20
+ Rails.application.routes.draw do
21
+ get '/test' => 'foobar#test', :as => :test
22
+ root :to => "foobar#test"
23
+ end
24
+
@@ -0,0 +1 @@
1
+ <%= root_url(:site => :us) %>
@@ -0,0 +1,2 @@
1
+ <%= root_url %>
2
+
@@ -0,0 +1,2 @@
1
+ <%= root_url(:site => :xx) %>
2
+
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ ActionController::Base.prepend_view_path 'spec/views'
4
+
5
+ describe "widget_default.erb" do
6
+ it "renders the widget partial with default locale set" do
7
+ I18n.locale = I18n.default_locale
8
+ render
9
+ rendered.should =~ /www.test.host/
10
+ end
11
+ end
12
+
13
+ describe "widget.erb" do
14
+ it "renders the widget partial for it" do
15
+ I18n.locale = :'it-IT'
16
+ render
17
+ rendered.should =~ /www.test.host/
18
+ end
19
+ end
20
+
21
+ describe "widget_invalid.erb" do
22
+ it "raises error when site does not exist" do
23
+ expect {
24
+ render
25
+ }.to raise_exception(ActionView::Template::Error)
26
+ end
27
+ end
28
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: localized
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Hepworth
@@ -83,6 +83,10 @@ files:
83
83
  - spec/lib/localized/config_spec.rb
84
84
  - spec/lib/localized/helper_spec.rb
85
85
  - spec/spec_helper.rb
86
+ - spec/views/widget.erb
87
+ - spec/views/widget_default.erb
88
+ - spec/views/widget_invalid.erb
89
+ - spec/views/widget_views_spec.rb
86
90
  has_rdoc: true
87
91
  homepage:
88
92
  licenses: []