Skip to content

Commit

Permalink
fix default scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Jan 10, 2024
1 parent aaa81fe commit cab9dbc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
jobs:
test:
name: RSpec
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11
Expand All @@ -29,10 +29,14 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: 119.0.6045.105

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
Expand Down
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
config.cache_classes = false

# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
Expand Down
6 changes: 3 additions & 3 deletions spec/models/assembly_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Decidim
end

it "has no default scope" do
expect(Assembly.default_scope).not_to be_present
expect(Assembly.all.to_sql).not_to include("WHERE")
expect(Assembly.scope_types).not_to be_present
expect(Assembly.scope_types_mode).not_to be_present
end
Expand All @@ -41,7 +41,7 @@ module Decidim
end

it "has a default scope" do
expect(Assembly.default_scope).to be_present
expect(Assembly.all.to_sql).to include("WHERE")
expect(Assembly.scope_types).to eq([type1.id])
expect(Assembly.scope_types_mode).to eq(:include)
end
Expand All @@ -60,7 +60,7 @@ module Decidim
end

it "has a default scope" do
expect(Assembly.default_scope).to be_present
expect(Assembly.all.to_sql).to include("WHERE")
expect(Assembly.scope_types).to eq([type2.id])
expect(Assembly.scope_types_mode).to eq(:exclude)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/models/participatory_process_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Decidim
end

it "has no default scope" do
expect(ParticipatoryProcess.default_scope).not_to be_present
expect(ParticipatoryProcess.all.to_sql).not_to include("WHERE")
expect(ParticipatoryProcess.scoped_slug_namespace).not_to be_present
expect(ParticipatoryProcess.scoped_slug_prefixes).not_to be_present
expect(ParticipatoryProcess.scoped_slug_prefixes_mode).not_to be_present
Expand All @@ -35,7 +35,7 @@ module Decidim
end

it "has a default scope" do
expect(ParticipatoryProcess.default_scope).to be_present
expect(ParticipatoryProcess.all.to_sql).to include("WHERE")
expect(ParticipatoryProcess.scoped_slug_namespace).to eq(namespace)
expect(ParticipatoryProcess.scoped_slug_prefixes).to eq([scoped_slug_prefix])
expect(ParticipatoryProcess.scoped_slug_prefixes_mode).to eq(:include)
Expand All @@ -54,7 +54,7 @@ module Decidim
end

it "has a default scope" do
expect(ParticipatoryProcess.default_scope).to be_present
expect(ParticipatoryProcess.all.to_sql).to include("WHERE")
expect(ParticipatoryProcess.scoped_slug_namespace).to eq(namespace)
expect(ParticipatoryProcess.scoped_slug_prefixes).to eq([scoped_slug_prefix])
expect(ParticipatoryProcess.scoped_slug_prefixes_mode).to eq(:exclude)
Expand Down

0 comments on commit cab9dbc

Please sign in to comment.