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:
commit
a6415fce44
2 changed files with 25 additions and 0 deletions
|
@ -298,6 +298,19 @@ describe "named scopes with the new DSL" do
|
||||||
it "does not create scopes if requested" do
|
it "does not create scopes if requested" do
|
||||||
expect(MultipleNoScope).not_to respond_to(:pending)
|
expect(MultipleNoScope).not_to respond_to(:pending)
|
||||||
end
|
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
|
end # scopes
|
||||||
|
|
||||||
describe "direct assignment" do
|
describe "direct assignment" do
|
||||||
|
|
|
@ -299,6 +299,18 @@ describe "named scopes with the new DSL" do
|
||||||
expect(NoScope).not_to respond_to(:pending)
|
expect(NoScope).not_to respond_to(:pending)
|
||||||
end
|
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
|
end # scopes
|
||||||
|
|
||||||
describe "direct assignment" do
|
describe "direct assignment" do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue