Skip to content

Commit

Permalink
Merge pull request #557 from uroesch/better_descriptions
Browse files Browse the repository at this point in the history
Adding better matcher descriptions
  • Loading branch information
mizzy committed Feb 27, 2016
2 parents 75cb0f7 + 6fb1eaa commit 11ed792
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/serverspec/matcher/be_enabled.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
end
end

description do
message = 'be enabled'
message << " with level #{@level}" if @level
message
end

chain :with_level do |level|
@level = level
end
Expand Down
7 changes: 7 additions & 0 deletions lib/serverspec/matcher/be_listening.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
port.listening? @with, @local_address
end

description do
message = 'be listening'
message << " on #{@local_address}" if @local_address
message << " with #{@with}" if @with
message
end

chain :with do |with|
@with = with
end
Expand Down
6 changes: 6 additions & 0 deletions lib/serverspec/matcher/be_running.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
end
end

description do
message = 'be running'
message << " under #{@under}" if @under
message
end

chain :under do |under|
@under = under
end
Expand Down
8 changes: 8 additions & 0 deletions lib/serverspec/matcher/have_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
end
end

description do
message = %Q{have rule "#{rule}"}
message << " with table #{@table}" if @table
message << ' and' if @table && @chain
message << " with chain #{@chain}" if @chain
message
end

chain :with_table do |table|
@table = table
end
Expand Down

0 comments on commit 11ed792

Please sign in to comment.