Skip to content

Commit

Permalink
Merge pull request #2004 from tf/rails-6-fixes-paged
Browse files Browse the repository at this point in the history
Fix paged specs for Rails 6
  • Loading branch information
tf authored Sep 18, 2023
2 parents f42e681 + fbe7f09 commit f3d0329
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ jobs:
plugin-name: pageflow_paged
rspec-command: bin/rspec

- engine-name: pageflow_paged
ruby-version: 3.2
rails-version: "~> 6.1"
engine-directory: entry_types/paged
plugin-name: pageflow_paged
rspec-command: bin/rspec

- engine-name: pageflow_scrolled
ruby-version: 2.6
engine-directory: entry_types/scrolled
Expand Down
6 changes: 3 additions & 3 deletions doc/creating_entry_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ editor.registerEntryType('rainbow', {

browserNotSupportedView: BrowserNotSupportedView
});
```
```

### REST Controllers

Expand Down Expand Up @@ -287,10 +287,10 @@ module Rainbow

describe '#create' do
it 'succeeds' do
entry = create(:entry)
entry = create(:entry, entry_type: 'rainbow')

authorize_for_editor_controller(entry)
post(:create, params: {entry_id: entry.id}, format: 'json')
post(:create, params: {entry_type: 'rainbow', entry_id: entry.id}, format: 'json')

expect(response.status).to eq(204)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def main_app
entry = create(:entry)

authorize_for_editor_controller(entry)
get(:partials, params: {entry_id: entry})
get(:partials, params: {entry_type: 'paged', entry_id: entry})

expect(response.status).to eq(200)
end

it 'requires authentication' do
entry = create(:entry)

get(:partials, params: {entry_id: entry})
get(:partials, params: {entry_type: 'paged', entry_id: entry})

expect(response).to redirect_to(main_app.new_user_session_path)
end
Expand All @@ -55,7 +55,7 @@ def main_app
create(:widget, subject: entry.draft, role: 'footer', type_name: 'non_editor_widget')

authorize_for_editor_controller(entry)
get(:partials, params: {entry_id: entry})
get(:partials, params: {entry_type: 'paged', entry_id: entry})

expect(response.body).to have_selector('div.test_widget')
expect(response.body).not_to have_selector('div.non_editor_widget')
Expand All @@ -76,7 +76,7 @@ def main_app
entry.draft.update(locale: 'de')

authorize_for_editor_controller(entry)
get(:partials, params: {entry_id: entry})
get(:partials, params: {entry_type: 'paged', entry_id: entry})

expect(response.body).to have_selector('div[lang=de]')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module PageflowPaged
pageflow_configure do |config|
config.for_entry_type(PageflowPaged.entry_type) do |c|
c.page_types.register(Pageflow::TestPageType.new(name: 'test',
template_path: 'test/page.html.erb'))
template_path: 'test/page'))
end
end

Expand Down

0 comments on commit f3d0329

Please sign in to comment.