Skip to content

Instantly share code, notes, and snippets.

@alpaca-tc
Created October 1, 2021 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alpaca-tc/9ce5c09bae477be96534338933627df8 to your computer and use it in GitHub Desktop.
Save alpaca-tc/9ce5c09bae477be96534338933627df8 to your computer and use it in GitHub Desktop.
diff --git a/Gemfile b/Gemfile
index 8d3bc88..6272179 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,6 +23,11 @@ group :development, :test do
gem "debug", ">= 1.0.0", platforms: %i[ mri mingw x64_mingw ]
end
+group :test do
+ gem 'rspec'
+ gem 'rspec-rails'
+end
+
group :development do
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
diff --git a/Gemfile.lock b/Gemfile.lock
index d77b7b6..0d572c5 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -65,6 +65,7 @@ GEM
debug (1.2.2)
irb (>= 1.3.6)
reline (>= 0.2.7)
+ diff-lcs (1.4.4)
erubi (1.10.0)
globalid (0.5.2)
activesupport (>= 5.0)
@@ -121,6 +122,27 @@ GEM
rake (13.0.6)
reline (0.2.7)
io-console (~> 0.5)
+ rspec (3.10.0)
+ rspec-core (~> 3.10.0)
+ rspec-expectations (~> 3.10.0)
+ rspec-mocks (~> 3.10.0)
+ rspec-core (3.10.1)
+ rspec-support (~> 3.10.0)
+ rspec-expectations (3.10.1)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.10.0)
+ rspec-mocks (3.10.2)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.10.0)
+ rspec-rails (5.0.2)
+ actionpack (>= 5.2)
+ activesupport (>= 5.2)
+ railties (>= 5.2)
+ rspec-core (~> 3.10)
+ rspec-expectations (~> 3.10)
+ rspec-mocks (~> 3.10)
+ rspec-support (~> 3.10)
+ rspec-support (3.10.2)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
@@ -144,6 +166,8 @@ DEPENDENCIES
debug (>= 1.0.0)
puma (~> 5.0)
rails (~> 7.0.0.alpha1)
+ rspec
+ rspec-rails
sqlite3 (~> 1.4)
tzinfo-data
diff --git a/app/views/root/index.html.erb b/app/views/root/index.html.erb
new file mode 100644
index 0000000..e69de29
diff --git a/spec/index.html.erb_spec.rb b/spec/index.html.erb_spec.rb
new file mode 100644
index 0000000..4b160bb
--- /dev/null
+++ b/spec/index.html.erb_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
+
+require 'rspec/rails'
+
+RSpec.describe 'root/index.html.erb', type: :view do
+ it do
+ # expected no Exception, got #<ActionView::MissingTemplate: Missing template root/index with {:locale=>[:en], :formats=>[:html], :...ariants=>[], :handlers=>["erb"]}.
+ expect { render }.to_not raise_error
+ end
+end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment