Skip to content

Commit

Permalink
add failing tests for joins bug
Browse files Browse the repository at this point in the history
  • Loading branch information
seanlinsley committed Aug 15, 2018
1 parent 2e697fd commit 3c08782
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/paper_trail/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -850,4 +850,20 @@
expect(widget.versions.empty?).to(eq(true))
end
end

context "joins" do
it "works" do
model = Song
model.create!
result = model.joins(:versions).select("songs.*, max(versions.event) as event").first
expect(result.event).to eq("create")
end

it "works on an STI model" do
model = Family::CelebrityFamily
model.create!
result = model.joins(:versions).select("families.*, max(versions.event) as event").first
expect(result.event).to eq("create")
end
end
end

0 comments on commit 3c08782

Please sign in to comment.