Skip to content

Commit

Permalink
Add test to ensure import form has multipart enctype applied (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
westonganger authored Feb 9, 2025
1 parent 5fcc546 commit bedde50
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions rails_i18n_manager.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency "sqlite3"
spec.add_development_dependency "rspec-rails"
spec.add_development_dependency "rspec-html-matchers"
spec.add_development_dependency "factory_bot_rails"
spec.add_development_dependency "database_cleaner"
spec.add_development_dependency "rails-controller-testing"
Expand Down
6 changes: 6 additions & 0 deletions spec/request/translations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ module RailsI18nManager
end

context "import" do
it "renders multipart form enctype" do
get rails_i18n_manager.import_translations_path
expect(response).to have_http_status(200)
expect(response.body).to have_tag(:form, action: "#{rails_i18n_manager.import_translations_path}", enctype: "multipart/form-data")
end

it "behaves as expected when nothing uploaded" do
get rails_i18n_manager.import_translations_path
expect(response).to have_http_status(200)
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
require "factory_bot_rails"
require "faker"
require "minitest_change_assertions"
require "rspec-html-matchers"

require "active_support/all"

RSpec.configure do |config|
config.include RSpecHtmlMatchers

config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
Expand Down

0 comments on commit bedde50

Please sign in to comment.