Sha256: 0fa8fd008028fb2b862bf36346671e9ccc88ae9733046c24ef67150c6693f6e3

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe Decidim::Budgets::FilteredProjects do
  let(:organization) { create(:organization) }
  let(:participatory_process) { create(:participatory_process, organization: organization) }
  let(:feature) { create(:budget_feature, participatory_space: participatory_process) }
  let(:another_feature) { create(:budget_feature, participatory_space: participatory_process) }

  let(:projects) { create_list(:project, 3, feature: feature) }
  let(:old_projects) { create_list(:project, 3, feature: feature, created_at: 10.days.ago) }
  let(:another_projects) { create_list(:project, 3, feature: another_feature) }

  it "returns projects included in a collection of features" do
    expect(Decidim::Budgets::FilteredProjects.for([feature, another_feature])).to match_array projects.concat(old_projects, another_projects)
  end

  it "returns projects created in a date range" do
    expect(Decidim::Budgets::FilteredProjects.for([feature, another_feature], 2.weeks.ago, 1.week.ago)).to match_array old_projects
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb
decidim-0.6.7 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb
decidim-0.6.6 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb
decidim-0.6.5 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb
decidim-0.6.4 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb
decidim-0.6.3 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb
decidim-0.6.2 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb
decidim-0.6.1 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb
decidim-0.6.0 decidim-budgets/spec/queries/decidim/budgets/filtered_projects_spec.rb