Skip to content

Commit

Permalink
Merge pull request #591 from yast/rspec_table_helper
Browse files Browse the repository at this point in the history
add rspec helper for testing table
  • Loading branch information
jreidinger committed Jun 16, 2017
2 parents b40429d + b38af29 commit 15350bb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions library/cwm/src/lib/cwm/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,25 @@
include_examples "CWM::AbstractWidget"
include_examples "CWM::ItemsSelection"
end

RSpec.shared_examples "CWM::Table" do
include_examples "CWM::AbstractWidget"

describe "#header" do
it "produces an array of strings" do
expect(subject.header).to be_an Enumerable
subject.header.each do |header|
expect(header).to be_a String
end
end
end

describe "#items" do
it "produces an array of arrays" do
expect(subject.items).to be_an Enumerable
subject.items.each do |item|
expect(item).to be_a Array
end
end
end
end
1 change: 1 addition & 0 deletions library/cwm/test/table_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ def items
end
subject { MyTable.new }

include_examples "CWM::Table"
include_examples "CWM::CustomWidget"
end

0 comments on commit 15350bb

Please sign in to comment.