summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFletcher Nichol <fnichol@nichol.ca>2012-11-08 11:17:35 -0700
committerBryan McLellan <btm@opscode.com>2012-11-20 12:48:19 -0800
commit46f58b13432085f28ca2aaadaed5ab54b5d536ae (patch)
tree3593275e2265af48870b3ec455424d0e32eccbed
parent8dc20721f1c4afc3e8434516d1ebf3bc0d9264d9 (diff)
downloadchef-46f58b13432085f28ca2aaadaed5ab54b5d536ae.tar.gz
[CHEF-3597] Handle frozen strings in knife.rb chef_server_url var.
-rw-r--r--chef/lib/chef/config.rb2
-rw-r--r--chef/spec/unit/config_spec.rb8
2 files changed, 9 insertions, 1 deletions
diff --git a/chef/lib/chef/config.rb b/chef/lib/chef/config.rb
index 6817ab008a..702aa04a9e 100644
--- a/chef/lib/chef/config.rb
+++ b/chef/lib/chef/config.rb
@@ -67,7 +67,7 @@ class Chef
# url<String>:: String to be set for all of the chef-server-api URL's
#
config_attr_writer :chef_server_url do |url|
- url.strip!
+ url = url.strip
configure do |c|
[ :registration_url,
:template_url,
diff --git a/chef/spec/unit/config_spec.rb b/chef/spec/unit/config_spec.rb
index 89161c9df1..f26b7a39eb 100644
--- a/chef/spec/unit/config_spec.rb
+++ b/chef/spec/unit/config_spec.rb
@@ -62,6 +62,14 @@ describe Chef::Config do
it_behaves_like "server URL"
end
+ context "when the url is a frozen string" do
+ before do
+ Chef::Config.chef_server_url = " https://junglist.gen.nz".freeze
+ end
+
+ it_behaves_like "server URL"
+ end
+
describe "class method: manage_secret_key" do
before do
Chef::FileCache.stub!(:load).and_return(true)