Skip to content

Commit

Permalink
Firstly add kind to the issue
Browse files Browse the repository at this point in the history
The kinds must be added to the issues
  • Loading branch information
davidakachaos committed May 11, 2012
1 parent ade127f commit e24ac52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/preflight/issue.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
module Preflight module Preflight
class Issue class Issue


attr_reader :description, :rule, :attributes attr_reader :description, :rule, :attributes, :kind


def initialize(description, rule, attributes = {}) def initialize(description, rule, attributes = {}, kind = :error)
@description = description @description = description
@kind = kind
if rule.is_a?(Class) if rule.is_a?(Class)
@rule = rule.to_s.to_sym @rule = rule.to_s.to_sym
else else
Expand Down
7 changes: 6 additions & 1 deletion spec/issue_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
let!(:issue) do let!(:issue) do
Preflight::Issue.new("Transparency detected", Preflight::Issue.new("Transparency detected",
Preflight::Rules::NoTransparency, Preflight::Rules::NoTransparency,
{:page => 1} {:page => 1},
:error
) )
end end


Expand All @@ -26,6 +27,10 @@
issue.page.should == 1 issue.page.should == 1
end end


it "should return the kind as a symbol" do
issue.kind.should == :error
end

it "should return true to a respond_to? call" do it "should return true to a respond_to? call" do
issue.respond_to?(:page).should be_true issue.respond_to?(:page).should be_true
end end
Expand Down

0 comments on commit e24ac52

Please sign in to comment.