Skip to content

Commit

Permalink
Add missing method to testing documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nonusae committed Oct 24, 2018
1 parent cf5a82f commit 76f2c01
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ format.xlsx {
}
```

If you use `render xlsx:` the gem will try to guess the file name:
If you use `render xlsx:` the gem will try to guess the file name:

```ruby
# filename of 'buttons'
Expand Down Expand Up @@ -212,7 +212,7 @@ class UserMailer < ActionMailer::Base
end
```

* If the route specifies or suggests the `:xlsx` format you do not need to specify `formats` or `handlers`.
* If the route specifies or suggests the `:xlsx` format you do not need to specify `formats` or `handlers`.
* If the template (`users/export`) can refer to only one file (the xlsx.axlsx template), you do not need to specify `handlers`, provided the `formats` includes `:xlsx`.
* Specifying the encoding as 'base64' can avoid UTF-8 errors.

Expand Down Expand Up @@ -240,7 +240,7 @@ RSpec.shared_context 'axlsx' do
let(:template_path) do
['app', 'views', template_name]
end

# This helper will be used in tests
def render_template(locals = {})
axlsx_binding = Kernel.binding
Expand All @@ -254,7 +254,7 @@ RSpec.shared_context 'axlsx' do

# mimics an ActionView::Template class, presenting a 'source' method
# to retrieve the content of the template
axlsx_binding.eval(ActionView::Template::Handlers::AxlsxBuilder.call(Struct.new(:source).new(File.read(Rails.root.join(*template_path)))))
axlsx_binding.eval(ActionView::Template::Handlers::AxlsxBuilder.new.call(Struct.new(:source).new(File.read(Rails.root.join(*template_path)))))
axlsx_binding.local_variable_get(:wb)
end
end
Expand Down

0 comments on commit 76f2c01

Please sign in to comment.