Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save taketo1113/03335ecc1651e5dcb05b51014fbd2bfe to your computer and use it in GitHub Desktop.
Save taketo1113/03335ecc1651e5dcb05b51014fbd2bfe to your computer and use it in GitHub Desktop.
Render with locale for view spec
# app/views/samples/_hoge.html.slim
p
| {t('hogelabel')}
# spec/views/samples/_hoge.html.slim_spec.rb
require 'rails_helper'
RSpec.describe "samples/_hoge.html.slim", :type => :view do
before(:each) do
@hoge = FactoryGirl.build(:hoge)
end
it "renders" do
view.locale = :ja
render partial: 'samples/hoge', locals: { hoge: @hoge }
expect(rendered).to include("hogehoge")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment