Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalie committed Dec 29, 2022
1 parent a92e03a commit 5b233fe
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ GEM
rb-fsevent (0.9.8)
rb-inotify (0.10.1)
ffi (~> 1.0)
rbtrace (0.4.12)
rbtrace (0.4.14)
ffi (>= 1.0.6)
msgpack (>= 0.4.3)
optimist (>= 3.0.0)
Expand Down
10 changes: 5 additions & 5 deletions spec/v3/queries/custom_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

context 'key with identifier does not exist in user or organization' do
it 'creates custom key' do
expect(described_class.new({}, 'CustomKey').create(params).fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40')
expect(described_class.new({}, 'CustomKey').create(params, user).fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40')
end
end

Expand All @@ -33,7 +33,7 @@
end

it 'returns error' do
expect { described_class.new({}, 'CustomKey').create(params) }.to raise_error(Travis::API::V3::UnprocessableEntity)
expect { described_class.new({}, 'CustomKey').create(params, user) }.to raise_error(Travis::API::V3::UnprocessableEntity)
end
end

Expand All @@ -53,7 +53,7 @@
end

it 'returns error' do
expect { described_class.new({}, 'CustomKey').create(params) }.to raise_error(Travis::API::V3::UnprocessableEntity)
expect { described_class.new({}, 'CustomKey').create(params, user) }.to raise_error(Travis::API::V3::UnprocessableEntity)
end
end
end
Expand All @@ -75,7 +75,7 @@

context 'key with identifier does not exist in user or organization' do
it 'creates custom key' do
expect(described_class.new({}, 'CustomKey').create(params).fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40')
expect(described_class.new({}, 'CustomKey').create(params, user).fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40')
end
end

Expand All @@ -92,7 +92,7 @@
end

it 'returns error' do
expect { described_class.new({}, 'CustomKey').create(params) }.to raise_error(Travis::API::V3::UnprocessableEntity)
expect { described_class.new({}, 'CustomKey').create(params, user) }.to raise_error(Travis::API::V3::UnprocessableEntity)
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions spec/v3/services/custom_keys/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@

describe "creating custom key" do
before { post('/v3/custom_keys', options, headers) }
example { expect(parsed_body).to eql_json({
example { expect(parsed_body.except("id")).to eql_json({
"@type" => "custom_key",
"@representation" => "standard",
"id" => 1,
"name" => "TEST_KEY",
"description" => "",
"public_key" =>
Expand Down
1 change: 1 addition & 0 deletions spec/v3/services/installation/find_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@type" => "allowance",
"id" => 1
},
"custom_keys" => [],
"allow_migration" => false,
"recently_signed_up" => false,
"secure_user_hash" => nil,
Expand Down
6 changes: 4 additions & 2 deletions spec/v3/services/organization/find_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"@type" => "allowance",
"@representation" => "minimal",
"id" => org.id
}
},
"custom_keys" => []
}}
end

Expand Down Expand Up @@ -63,7 +64,8 @@
"@type" => "allowance",
"@representation" => "minimal",
"id" => org.id
}
},
"custom_keys" => []
}}
end

Expand Down
3 changes: 2 additions & 1 deletion spec/v3/services/organizations/for_current_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"@type" => "allowance",
"@representation" => "minimal",
"id" => org.id
}
},
"custom_keys" => []
}]
}}
end
Expand Down
16 changes: 13 additions & 3 deletions spec/v3/services/owner/find_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"@type" => "allowance",
"@representation" => "minimal",
"id" => org.id
}
},
"custom_keys" => []
}}
end

Expand All @@ -54,7 +55,8 @@
"@type" => "allowance",
"@representation" => "minimal",
"id" => org.id
}
},
"custom_keys" => []
}}
end

Expand Down Expand Up @@ -86,6 +88,7 @@
"@representation" => "minimal",
"id" => org.id
},
"custom_keys" => [],
"repositories" => [{
"@type" => "repository",
"@href" => "/v3/repo/#{repo.id}",
Expand Down Expand Up @@ -162,6 +165,7 @@
"@representation" => "minimal",
"id" => org.id
},
"custom_keys" => [],
"repositories" => [{
"@type" => "repository",
"@href" => "/v3/repo/#{repo.id}",
Expand Down Expand Up @@ -232,7 +236,8 @@
"@type" => "allowance",
"@representation" => "minimal",
"id" => org.id
}
},
"custom_keys" => []
}}
end

Expand Down Expand Up @@ -263,6 +268,7 @@
"@representation" => "minimal",
"id" => org.id
},
"custom_keys" => [],
"@warnings" => [{
"@type" => "warning",
"message" => "query parameter organization.id not safelisted, ignored",
Expand Down Expand Up @@ -302,6 +308,7 @@
"@representation" => "minimal",
"id" => user.id
},
"custom_keys" => [],
"recently_signed_up"=>false,
"secure_user_hash" => nil,
"ro_mode" => false,
Expand Down Expand Up @@ -334,6 +341,7 @@
"@representation" => "minimal",
"id" => user.id
},
"custom_keys" => [],
"recently_signed_up"=>false,
"secure_user_hash" => nil,
"ro_mode" => false,
Expand Down Expand Up @@ -366,6 +374,7 @@
"@representation" => "minimal",
"id" => user.id
},
"custom_keys" => [],
"recently_signed_up"=>false,
"secure_user_hash" => nil,
"ro_mode" => false,
Expand Down Expand Up @@ -402,6 +411,7 @@
"@representation" => "minimal",
"id" => user.id
},
"custom_keys" => [],
"recently_signed_up"=>false,
"secure_user_hash" => nil,
"ro_mode" => false,
Expand Down
1 change: 1 addition & 0 deletions spec/v3/services/user/current_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@representation" => "minimal",
"id" => user.id
},
"custom_keys" => [],
"recently_signed_up"=>false,
"secure_user_hash" => nil,
"ro_mode" => true,
Expand Down
1 change: 1 addition & 0 deletions spec/v3/services/user/find_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@representation" => "minimal",
"id" => user.id
},
"custom_keys" => [],
"recently_signed_up"=>false,
"secure_user_hash" => nil,
"ro_mode" => false,
Expand Down
1 change: 1 addition & 0 deletions spec/v3/services/v2_subscription/executions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"@representation"=>"minimal",
"id"=>1
},
"custom_keys" => [],
"email"=>"[email protected]",
"is_syncing"=>nil,
"synced_at"=>nil,
Expand Down

0 comments on commit 5b233fe

Please sign in to comment.