1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00
paper-trail-gem--paper_trail/spec/models/joined_version_spec.rb
Jared Beck 38fa23873c Merge rails_helper into spec_helper
The reason some projects have both is so that some spec files can be
run in isolation, without the rails stuff. In practice, I don't find
myself ever doing this. So, the complexity of two files is unnecessary.
2017-05-30 00:59:55 -04:00

41 lines
1.1 KiB
Ruby

require "spec_helper"
RSpec.describe JoinedVersion, type: :model, versioning: true do
let(:widget) { Widget.create!(name: FFaker::Name.name) }
let(:version) { JoinedVersion.first }
describe "default_scope" do
it { expect(JoinedVersion.default_scopes).not_to be_empty }
end
describe "VersionConcern::ClassMethods" do
before { widget } # persist a widget
describe "#subsequent" do
it "does not raise error when there is a default_scope that joins" do
JoinedVersion.subsequent(version).first
end
end
describe "#preceding" do
it "does not raise error when there is a default scope that joins" do
JoinedVersion.preceding(version).first
end
end
describe "#between" do
it "does not raise error when there is a default scope that joins" do
JoinedVersion.between(Time.now, 1.minute.from_now).first
end
end
end
describe "#index" do
it { is_expected.to respond_to(:index) }
it "does not raise error when there is a default scope that joins" do
widget # persist a widget
version.index
end
end
end