Skip to content

Commit

Permalink
Add side-by-side test coverage to command recorder
Browse files Browse the repository at this point in the history
Also added coverage for `no_data`
  • Loading branch information
derekprior committed Jan 2, 2025
1 parent 3e09798 commit 269150c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/scenic/command_recorder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@
expect { recorder.revert { recorder.update_view(*args) } }
.to raise_error(ActiveRecord::IrreversibleMigration)
end

it "reverts materialized views with no_data option appropriately" do
args = [:users, {version: 2, revert_to_version: 1, materialized: {no_data: true}}]
revert_args = [:users, {version: 1, materialized: {no_data: true}}]

recorder.revert { recorder.update_view(*args) }

expect(recorder.commands).to eq [[:update_view, revert_args]]
end

it "reverts materialized views with side_by_side option appropriately" do
args = [:users, {version: 2, revert_to_version: 1, materialized: {side_by_side: true}}]
revert_args = [:users, {version: 1, materialized: {side_by_side: true}}]

recorder.revert { recorder.update_view(*args) }

expect(recorder.commands).to eq [[:update_view, revert_args]]
end
end

describe "#replace_view" do
Expand Down

0 comments on commit 269150c

Please sign in to comment.