Skip to content

Commit 60fa3e9

Browse files
committed
test(api:repositories): failing test for commit listing
1 parent 6a9fd23 commit 60fa3e9

1 file changed

Lines changed: 43 additions & 1 deletion

File tree

spec/repositories_spec.cr

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,51 @@ module PlaceOS::Api
6969
end
7070
end
7171

72+
describe "GET /:id/commits" do
73+
context "interface" do
74+
pending "fetches the commits for a repository" do
75+
end
76+
end
77+
78+
context "driver" do
79+
repo = Model::Generator.repository(type: :driver)
80+
repo.uri = "https://github.com/placeOS/private-drivers"
81+
repo.save!
82+
83+
it "fetches the commits for a repository" do
84+
id = repo.id.as(String)
85+
path = "#{base}#{id}/commits"
86+
result = curl(
87+
method: "GET",
88+
path: path,
89+
headers: authorization_header.merge({"Content-Type" => "application/json"}),
90+
)
91+
92+
result.status.should eq HTTP::Status::OK
93+
Array(String).from_json(result.body).should_not be_empty
94+
end
95+
96+
it "fetches the commits for a file" do
97+
id = repo.id.as(String)
98+
params = HTTP::Params{
99+
"driver" => "drivers/place/private_helper.cr",
100+
}
101+
path = "#{base}#{id}/commits?#{params}"
102+
result = curl(
103+
method: "GET",
104+
path: path,
105+
headers: authorization_header.merge({"Content-Type" => "application/json"}),
106+
)
107+
108+
result.status.should eq HTTP::Status::OK
109+
Array(String).from_json(result.body).should_not be_empty
110+
end
111+
end
112+
end
113+
72114
describe "driver only actions" do
73115
it "errors if enumerating drivers in an interface repo" do
74-
repository = Model::Generator.repository(type: Model::Repository::Type::Interface).save!
116+
repository = Model::Generator.repository(type: :interface).save!
75117

76118
id = repository.id.as(String)
77119
path = "#{base}#{id}/drivers"

0 commit comments

Comments
 (0)