spec: move out wrong nested context

main
Washington Botelho 2018-01-15 22:04:05 -02:00
parent 46530d5999
commit 71f31e09ea
No known key found for this signature in database
GPG Key ID: BECE10A8106CC7A0
1 changed files with 26 additions and 26 deletions

View File

@ -144,39 +144,39 @@ RSpec.describe Rating::Extension, ':order_by_rating' do
end end
end end
end end
end
context 'filtering by :total' do context 'filtering by :total' do
context 'as asc' do context 'as asc' do
it 'works' do it 'works' do
result = Article.order_by_rating(:total, :asc) result = Article.order_by_rating(:total, :asc)
expect(result[0..1]).to match_array [article_2, article_3] expect(result[0..1]).to match_array [article_2, article_3]
expect(result.last).to eq article_1 expect(result.last).to eq article_1
end
context 'with scope' do
it 'works' do
expect(Article.order_by_rating(:total, :asc, scope: category)).to eq [
article_1
]
end
end
end end
context 'as desc' do context 'with scope' do
it 'works' do it 'works' do
result = Article.order_by_rating(:total, :desc) expect(Article.order_by_rating(:total, :asc, scope: category)).to eq [
article_1
expect(result.first).to eq article_1 ]
expect(result[1..2]).to match_array [article_2, article_3]
end end
end
end
context 'with scope' do context 'as desc' do
it 'works' do it 'works' do
expect(Article.order_by_rating(:total, :desc, scope: category)).to eq [ result = Article.order_by_rating(:total, :desc)
article_1
] expect(result.first).to eq article_1
end expect(result[1..2]).to match_array [article_2, article_3]
end
context 'with scope' do
it 'works' do
expect(Article.order_by_rating(:total, :desc, scope: category)).to eq [
article_1
]
end end
end end
end end