Permalink
Browse files

Fix cannot convert nil to string.

  • Loading branch information...
1 parent f3b837d commit 83537c6b62e66ae44c18fb35242e65953b66eb25 @bobbytables committed Dec 20, 2012
Showing with 17 additions and 1 deletion.
  1. +1 −1 lib/table_cloth/columns/action.rb
  2. +16 −0 spec/lib/presenters/default_spec.rb
@@ -5,7 +5,7 @@ def value(object, view_context, table)
actions_html = actions.each_with_object('') do |action, links|
if action.available?(table)
links << "\n"
- links << view_context.instance_exec(object, view_context, &action.options[:proc])
+ links << (view_context.instance_exec(object, view_context, &action.options[:proc]) || "")
end
end
@@ -151,6 +151,22 @@
td = doc.at_css('td:last')
td[:class].should include "actions"
end
+
+ context "empty actions" do
+ let(:dummy_table) do
+ Class.new(TableCloth::Base) do
+ actions do
+ action { nil }
+ end
+ end
+ end
+
+ it "changes nil to empty string" do
+ doc = Nokogiri::HTML(subject.render_table)
+ td = doc.at_css('td:last')
+ expect(td.text).to eq "\n"
+ end
+ end
end
context 'by value of row column' do

0 comments on commit 83537c6

Please sign in to comment.