Skip to content

Commit

Permalink
Issue: When a hash key is named 'test', everything blows up
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaspar Schiess committed Nov 8, 2012
1 parent e7dfdb7 commit 8616612
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spec/files/cook/config/nodes/node.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node 'node' do |cfg|
cook 'test'
end
13 changes: 13 additions & 0 deletions spec/integration/cook_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

describe "bocuse environment" do
let(:project) { Bocuse::Project.new(fixture('cook')) }

it "exports node_name" do
pending "Open issue" do
expect {
project.nodes['node'].to_h
}.not_to raise_error
end
end
end

1 comment on commit 8616612

@floere
Copy link
Contributor

@floere floere commented on 8616612 Nov 9, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably know all this, but for the sake of onlookers:
The problem is that the BlankSlate Bocuse::Configuration has a private method called #test. What we want is method_missing to be called. Instead, the existing private method is called. Since we use Ruby 1.9 in bocuse, we could theoretically make use of #public_send which respects visibility. However, BlankSlate does not implement that method, which in our case would result in :public_send being added to the configuration with the value "test".

The options probably are:

  • Remove private method #test. What about the others?
  • Add method #public_send, restricting the key space by one, but on the other hand enlarging it with all private method names.
  • Other option I haven't thought about.

Please sign in to comment.