Skip to content
This repository
Browse code

deprecate csv_column_separator in favor of using csv_options

  • Loading branch information...
commit 9185d12668ce23861547af168c3b191fedf82fd4 1 parent 1a4c214
Rachel Heaton authored September 26, 2012
11  lib/active_admin/application.rb
@@ -12,6 +12,11 @@ def self.inheritable_setting(name, default)
12 12
       setting name, default
13 13
     end
14 14
 
  15
+    def self.deprecated_inheritable_setting(name, default)
  16
+      Namespace.deprecated_setting name, nil
  17
+      deprecated_setting name, default
  18
+    end
  19
+
15 20
     # The default namespace to put controllers and routes inside. Set this
16 21
     # in config/initializers/active_admin.rb using:
17 22
     #
@@ -66,9 +71,6 @@ def self.inheritable_setting(name, default)
66 71
     # The namespace root.
67 72
     inheritable_setting :root_to, 'dashboard#index'
68 73
 
69  
-    # Default CSV separator
70  
-    inheritable_setting :csv_column_separator, ','
71  
-
72 74
     # Default CSV options
73 75
     inheritable_setting :csv_options, {}
74 76
 
@@ -85,6 +87,9 @@ def self.inheritable_setting(name, default)
85 87
 
86 88
     # == Deprecated Settings
87 89
 
  90
+    # @deprecated Default CSV separator will be removed in 0.6.0. Use `csv_options = { :col_sep => ',' }` instead.
  91
+    deprecated_inheritable_setting :csv_column_separator, ','
  92
+
88 93
     # @deprecated The default sort order for index pages
89 94
     deprecated_setting :default_sort_order, 'id_desc'
90 95
 
21  spec/unit/application_spec.rb
@@ -30,7 +30,7 @@
30 30
     application.site_title = "New Title"
31 31
     application.site_title.should == "New Title"
32 32
   end
33  
-  
  33
+
34 34
   it "should store the site's title link" do
35 35
     application.site_title_link.should == ""
36 36
   end
@@ -39,11 +39,11 @@
39 39
     application.site_title_link = "http://www.mygreatsite.com"
40 40
     application.site_title_link.should == "http://www.mygreatsite.com"
41 41
   end
42  
-  
  42
+
43 43
   it "should store the site's title image" do
44 44
     application.site_title_image.should == ""
45 45
   end
46  
-  
  46
+
47 47
   it "should set the site's title image" do
48 48
     application.site_title_image = "http://railscasts.com/assets/episodes/stills/284-active-admin.png?1316476106"
49 49
     application.site_title_image.should == "http://railscasts.com/assets/episodes/stills/284-active-admin.png?1316476106"
@@ -53,7 +53,7 @@
53 53
     application.view_factory.should be_an_instance_of(ActiveAdmin::ViewFactory)
54 54
   end
55 55
 
56  
-  it "should have deprecated admin notes by default" do 
  56
+  it "should have deprecated admin notes by default" do
57 57
     application.admin_notes.should be_nil
58 58
   end
59 59
 
@@ -80,6 +80,19 @@
80 80
     end
81 81
   end
82 82
 
  83
+  describe "inheritable settings" do
  84
+    it "should set csv_options" do
  85
+      application.csv_options.should == {}
  86
+    end
  87
+
  88
+    context "when deprecated" do
  89
+      it "should set and warn csv_column_separator" do
  90
+        ActiveAdmin::Deprecation.should_receive(:warn)
  91
+        application.csv_column_separator.should == ','
  92
+      end
  93
+    end
  94
+  end
  95
+
83 96
   describe "files in load path" do
84 97
     it "should load files in the first level directory" do
85 98
       application.files_in_load_path.should include(File.expand_path("app/admin/dashboard.rb", Rails.root))

0 notes on commit 9185d12

Please sign in to comment.
Something went wrong with that request. Please try again.