Skip to content

Commit

Permalink
Merge pull request #513 from mfazekas/webpacker
Browse files Browse the repository at this point in the history
Support for webpacker
  • Loading branch information
mathieujobin committed Apr 20, 2023
2 parents f14d297 + baa1bae commit d8f350b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
### Unreleased

* Support for (webpacker)[https://github.com/rails/webpacker/].
```ruby
suite.javascript_packs += ["your-custom-pack.js"]
```

### 1.3.0

* Officially drops support for Ruby 2.4 and Rails earlier than 4.2.11
Expand Down
3 changes: 3 additions & 0 deletions app/views/teaspoon/suite/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<%= stylesheet_link_tag *@suite.stylesheets %>
<%= javascript_include_tag *@suite.javascripts %>
<% @suite.javascript_packs.each do |javascript_pack| %>
<%= javascript_pack_tag javascript_pack %>
<% end %>
<script type="text/javascript">
Teaspoon.version = <%= Teaspoon::VERSION.to_json.html_safe %>;
Teaspoon.suites = <%= {all: Teaspoon.configuration.suite_configs.keys, active: @suite.name}.to_json.html_safe %>;
Expand Down
3 changes: 2 additions & 1 deletion lib/teaspoon/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def self.suite(name = :default, &block)
end

class Suite
attr_accessor :matcher, :helper, :javascripts, :stylesheets,
attr_accessor :matcher, :helper, :javascripts, :javascript_packs, :stylesheets,
:boot_partial, :body_partial,
:hooks, :expand_assets, :js_extensions

Expand All @@ -70,6 +70,7 @@ def initialize(name = nil)
@helper = "spec_helper"
@javascripts = []
@stylesheets = ["teaspoon"]
@javascript_packs = []

@boot_partial = "boot"
@body_partial = "body"
Expand Down
2 changes: 1 addition & 1 deletion lib/teaspoon/suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.resolve_spec_for(file)
end

attr_accessor :config, :name
delegate :helper, :stylesheets, :javascripts, :boot_partial, :body_partial, :hooks,
delegate :helper, :stylesheets, :javascripts, :javascript_packs, :boot_partial, :body_partial, :hooks,
to: :config

def initialize(options = {})
Expand Down

0 comments on commit d8f350b

Please sign in to comment.