-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #696 from alphagov/component-generator-test
Add component unit test to component generator
- Loading branch information
Showing
4 changed files
with
33 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
lib/generators/govuk_component/templates/component_test.rb.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'govuk_component_test_helper' | ||
|
||
class <%= "#{@test_name}TestCase" %> < ComponentTestCase | ||
def component_name | ||
"<%= file_name %>" | ||
end | ||
|
||
test "no error if no parameters passed in" do | ||
assert_nothing_raised do | ||
render_component({}) | ||
assert_select ".govuk-<%= @public_name %>" | ||
end | ||
end | ||
end |