Skip to content

Commit

Permalink
Merge pull request #18 from kawakamimoeki/remove_test_helper_from_def…
Browse files Browse the repository at this point in the history
…ault_export

Remove test helper from default export
  • Loading branch information
kawakamimoeki authored Oct 13, 2024
2 parents 698cca9 + 0f110f1 commit df0be82
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ end

```ruby
# spec/spec_helper.rb
require "clapton/test_helper/rspec"
RSpec.configure do |config|
config.include Clapton::TestHelper::RSpec, type: :component
Expand All @@ -291,6 +292,8 @@ end

```ruby
# test/test_helper.rb
require "clapton/test_helper/minitest"
class ActiveSupport::TestCase
include Clapton::TestHelper::Minitest
end
Expand Down
2 changes: 0 additions & 2 deletions lib/clapton.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
require "clapton/railtie"
require "clapton/engine"
require "clapton/state"
require "clapton/test_helper/rspec"
require "clapton/test_helper/minitest"
require "rails/generators/clapton_generator"

module Clapton
Expand Down
1 change: 1 addition & 0 deletions test/dummy/spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require 'selenium-webdriver'
require "clapton/test_helper/rspec"
# Add additional requires below this line. Rails is not loaded until this point!

# Requires supporting ruby files with custom matchers and macros, etc, in
Expand Down
3 changes: 2 additions & 1 deletion test/dummy/test/components/task_list_component_test.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
require "test_helper"
require "clapton/test_helper/minitest"

class TaskListComponentTest < ActiveSupport::TestCase
include Clapton::TestHelper::Minitest

test "renders" do
render_component(:TaskListComponent, tasks: [{ id: 1, title: "Task 1", done: false, due: Time.current }])
assert_selector "input[type='text']"
Expand Down
3 changes: 3 additions & 0 deletions test/dummy/test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ENV['RAILS_ENV'] ||= 'test'
require_relative "../config/environment"
require "rails/test_help"
require "clapton/test_helper/minitest"

class ActiveSupport::TestCase
# Run tests in parallel with specified workers
Expand All @@ -10,4 +11,6 @@ class ActiveSupport::TestCase
fixtures :all

# Add more helper methods to be used by all tests here...

include Clapton::TestHelper::Minitest
end

0 comments on commit df0be82

Please sign in to comment.