Skip to content

Commit d2e212d

Browse files
committed
Fix request specs path
1 parent f34f5e5 commit d2e212d

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

lib/generators/jsonapi/resource_generator.rb

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,37 +121,27 @@ def generate_route
121121

122122
def generate_tests
123123
if actions?('index')
124-
to = File.join "spec/api/v1/#{file_name.pluralize}",
125-
class_path,
126-
"index_spec.rb"
124+
to = File.join "spec/api/v1", url, "index_spec.rb"
127125
template('index_request_spec.rb.erb', to)
128126
end
129127

130128
if actions?('show')
131-
to = File.join "spec/api/v1/#{file_name.pluralize}",
132-
class_path,
133-
"show_spec.rb"
129+
to = File.join "spec/api/v1", url, "show_spec.rb"
134130
template('show_request_spec.rb.erb', to)
135131
end
136132

137133
if actions?('create')
138-
to = File.join "spec/api/v1/#{file_name.pluralize}",
139-
class_path,
140-
"create_spec.rb"
134+
to = File.join "spec/api/v1", url, "create_spec.rb"
141135
template('create_request_spec.rb.erb', to)
142136
end
143137

144138
if actions?('update')
145-
to = File.join "spec/api/v1/#{file_name.pluralize}",
146-
class_path,
147-
"update_spec.rb"
139+
to = File.join "spec/api/v1", url, "update_spec.rb"
148140
template('update_request_spec.rb.erb', to)
149141
end
150142

151143
if actions?('destroy')
152-
to = File.join "spec/api/v1/#{file_name.pluralize}",
153-
class_path,
154-
"destroy_spec.rb"
144+
to = File.join "spec/api/v1", url, "destroy_spec.rb"
155145
template('destroy_request_spec.rb.erb', to)
156146
end
157147
end

0 commit comments

Comments
 (0)