Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ViewResolver for Rails 6 #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/sir_trevor_rails/view_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ def find_templates(name, prefix, *args)
super(name, prefix.gsub(/^(.)+(sir_trevor)/, '\2'), *args)
end

def _find_all(name, prefix, *args)
super(name, prefix.gsub(/^(.)+(sir_trevor)/, '\2'), *args)
end

end
end
4 changes: 2 additions & 2 deletions spec/integration/editing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ class EditingSpec < ActionDispatch::IntegrationTest
let(:post) { Post.create(body: blocks_json(:text_html)) }

it 'serializes BlockArray to correct json' do
visit edit_post_path(post)
visit edit_blog_post_path(post)
expect { find_field('Body').value == {data: post.body.as_json}.to_json }
end

it 'serializes empty BlockArray to empty array json' do
post = Post.create()

visit edit_post_path(post)
visit edit_blog_post_path(post)
expect { find_field('Body').value == "{\"data\":[]}" }
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/rendering_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class RenderingSpec < ActionDispatch::IntegrationTest
describe 'SirTrevorContent rendering' do
it 'renders all blocks as separate divs' do
post = Post.create(body: blocks_json(:list_html, :text_html))
visit post_path(post)
visit blog_post_path(post)

expect { all('.st__content-block').length == 2 }
end
Expand Down Expand Up @@ -112,7 +112,7 @@ class RenderingSpec < ActionDispatch::IntegrationTest

def create_and_visit(json)
post = Post.create(body: json)
visit post_path(post)
visit blog_post_path(post)
end

def find_block(type)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class PostsController < ActionController::Base
class Blog::PostsController < ActionController::Base
def new
@post = Post.new
end
Expand Down
3 changes: 3 additions & 0 deletions spec/internal/app/views/blog/posts/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= form_for @post, url: blog_posts_path do |form| %>
<%= render form %>
<% end %>
3 changes: 0 additions & 3 deletions spec/internal/app/views/posts/edit.html.erb

This file was deleted.

4 changes: 3 additions & 1 deletion spec/internal/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Rails.application.routes.draw do
resources :posts
namespace :blog do
resources :posts
end
end