json_spec added. Create project via REST API fixed

This commit is contained in:
Alex Denisov 2012-09-04 09:38:48 +03:00
parent 6b3ce96a19
commit b73d4419ea
5 changed files with 22 additions and 49 deletions

View file

@ -39,55 +39,19 @@ describe Gitlab::API do
}.should change{Project.count}.by(1)
end
it "should create new project" do
expect {
name = "foo"
path = "bar"
code = "bazz"
description = "fuu project"
default_branch = "default_branch"
issues_enabled = false
wall_enabled = false
merge_requests_enabled = false
wiki_enabled = false
post api("/projects", user), {
code: code,
path: path,
name: name,
description: description,
default_branch: default_branch,
issues_enabled: issues_enabled,
wall_enabled: wall_enabled,
merge_requests_enabled: merge_requests_enabled,
wiki_enabled: wiki_enabled
}
response.status.should == 201
json_response["name"].should == name
json_response["path"].should == path
json_response["code"].should == code
json_response["description"].should == description
json_response["default_branch"].should == default_branch
json_response["issues_enabled"].should == issues_enabled
json_response["wall_enabled"].should == wall_enabled
json_response["merge_requests_enabled"].should == merge_requests_enabled
json_response["wiki_enabled"].should == wiki_enabled
}.should change{Project.count}.by(1)
end
it "should create new projects within all parameters" do
expect {
name = "foo"
path = "bar"
code = "bazz"
post api("/projects", user), {
code: code,
path: path,
name: name
}
response.status.should == 201
json_response["name"].should == name
json_response["path"].should == path
json_response["code"].should == code
}.should change{Project.count}.by(1)
attributes = Factory.attributes(:project,
name: "foo",
path: "bar",
code: "bazz",
description: "foo project",
default_branch: "default_branch",
issues_enabled: false,
wall_enabled: false,
merge_requests_enabled: false,
wiki_enabled: false)
post api("/projects", user), attributes
response.status.should == 201
response.body.should be_json_eql(attributes.to_json).excluding("owner", "private")
end
it "should not create project without name" do
expect {