Skip to content

Commit

Permalink
Adds specs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielricecodes committed Feb 11, 2023
1 parent ed0735c commit 9368e02
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion spec/unit/persistence/active_record_persistence_spec.rb
Expand Up @@ -346,11 +346,21 @@
expect(ImplementedAbstractClassDsl.unknown_scope.is_a?(ActiveRecord::Relation)).to be_truthy
expect(ImplementedAbstractClassDsl.another_unknown_scope.is_a?(ActiveRecord::Relation)).to be_truthy
end
it "should add negative scopes without the table_name" do
expect(ImplementedAbstractClassDsl).to respond_to(:not_unknown_scope)
expect(ImplementedAbstractClassDsl).to respond_to(:not_another_unknown_scope)

expect(ImplementedAbstractClassDsl.not_unknown_scope.is_a?(ActiveRecord::Relation)).to be_truthy
expect(ImplementedAbstractClassDsl.not_another_unknown_scope.is_a?(ActiveRecord::Relation)).to be_truthy
end
end
end

it "does not create scopes if requested" do
expect(NoScope).not_to respond_to(:pending)
aggregate_failures do
expect(NoScope).not_to respond_to(:pending)
expect(NoScope).not_to respond_to(:not_pending)
end
end

context "result of scope" do
Expand All @@ -364,6 +374,10 @@
it "created scope works as where(name: :scope_name)" do
expect(SimpleNewDsl.unknown_scope).to contain_exactly(dsl2)
end

it "created not scope works as where.not(name: :scope_name)" do
expect(SimpleNewDsl.not_unknown_scope).to contain_exactly(dsl1)
end
end
end # scopes

Expand Down

0 comments on commit 9368e02

Please sign in to comment.