Report class can define and retrieve header

This commit is contained in:
Rohan Mitchell
2015-07-23 09:36:09 +10:00
parent 61a39ea82f
commit 0a5e8fe629
2 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
module OpenFoodNetwork::Reports
class Report
# -- API
def header
@@header
end
# -- DSL
def self.header(*columns)
@@header = columns
end
end
end

View File

@@ -0,0 +1,15 @@
require 'open_food_network/reports/report'
module OpenFoodNetwork::Reports
class TestReport < Report
header 'One', 'Two', 'Three'
end
describe Report do
let(:report) { TestReport.new }
it "returns the header" do
report.header.should == %w(One Two Three)
end
end
end