Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
klaustopher committed Jun 26, 2024
1 parent 596a0fb commit d3d1e7e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/services/params_to_query_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def set_query_class(query_class, model)
else
model_name = model.name

"::Queries::#{model_name.pluralize}::#{model_name.demodulize}Query".constantize
"#{model_name.demodulize}Query".constantize
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ def initialize(from: nil, **)
def instance(_params)
@from || super
end

def instance_class
ProjectQuery
end
end
14 changes: 7 additions & 7 deletions spec/routing/project_queries_routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
require "spec_helper"

RSpec.describe "Project query routes" do
it "/projects/queries/new GET routes to projects/queries#new" do
expect(get("/projects/queries/new")).to route_to("projects/queries#new")
it "/project_queries/new GET routes to projects/queries#new" do
expect(get("/project_queries/new")).to route_to("projects/queries#new")
end

it "/projects/queries POST routes to projects/queries#create" do
expect(post("/projects/queries")).to route_to("projects/queries#create")
it "/project_queries POST routes to projects/queries#create" do
expect(post("/project_queries")).to route_to("projects/queries#create")
end

it "/projects/queries/:id DELETE routes to projects/queries#destroy" do
expect(delete("/projects/queries/42")).to route_to("projects/queries#destroy",
id: "42")
it "/project_queries/:id DELETE routes to projects/queries#destroy" do
expect(delete("/project_queries/42")).to route_to("projects/queries#destroy",
id: "42")
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

RSpec.describe Queries::Projects::ProjectQueries::CreateService, type: :model do
it_behaves_like "BaseServices create service" do
let(:model_class) { ProjectQuery }
let(:factory) { :project_query }
end

Expand Down

0 comments on commit d3d1e7e

Please sign in to comment.