1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

Merge pull request #276 from yui-knk/test_created_scope_members

Add test cases which validate results of defined scope
This commit is contained in:
Thorsten Böttger 2015-12-08 21:35:48 +13:00
commit a6415fce44
2 changed files with 25 additions and 0 deletions

View file

@ -298,6 +298,19 @@ describe "named scopes with the new DSL" do
it "does not create scopes if requested" do
expect(MultipleNoScope).not_to respond_to(:pending)
end
context "result of scope" do
let!(:dsl1) { MultipleSimpleNewDsl.create!(status: :new) }
let!(:dsl2) { MultipleSimpleNewDsl.create!(status: :unknown_scope) }
after do
MultipleSimpleNewDsl.destroy_all
end
it "created scope works as where(name: :scope_name)" do
expect(MultipleSimpleNewDsl.unknown_scope).to contain_exactly(dsl2)
end
end
end # scopes
describe "direct assignment" do

View file

@ -299,6 +299,18 @@ describe "named scopes with the new DSL" do
expect(NoScope).not_to respond_to(:pending)
end
context "result of scope" do
let!(:dsl1) { SimpleNewDsl.create!(status: :new) }
let!(:dsl2) { SimpleNewDsl.create!(status: :unknown_scope) }
after do
SimpleNewDsl.destroy_all
end
it "created scope works as where(name: :scope_name)" do
expect(SimpleNewDsl.unknown_scope).to contain_exactly(dsl2)
end
end
end # scopes
describe "direct assignment" do