fix specs for rspec

This commit is contained in:
Sven Fuchs 2014-06-21 15:54:11 +02:00
parent 4a0bdaafe6
commit 58ce449ca4
10 changed files with 23 additions and 22 deletions

View File

@ -69,7 +69,7 @@ describe Travis::Api::App::SettingsEndpoint do
response = get '/settings/items', { repository_id: repo.id }, headers
json = JSON.parse(response.body)
json['items'].should have(1).items
json['items'].length.should == 1
item = json['items'].first
item['name'].should == 'an item'
item['id'].should_not be_nil
@ -165,7 +165,7 @@ describe Travis::Api::App::SettingsEndpoint do
json['item']['id'].should == item.id
json['item'].should_not have_key('secret')
repo.reload.settings.items.should have(0).items
repo.reload.settings.items.length.should == 0
end
it 'returns 404 if item can\'t be found' do

View File

@ -37,7 +37,7 @@ describe 'Hooks' do
GH.stubs(:[]).returns([])
GH.expects(:post).with(target, payload).returns(GH.load(PAYLOADS[:github][:hook_active]))
response = put 'hooks', { hook: { id: hook.id, active: 'true' } }, headers
repo.reload.active?.should be_true
repo.reload.active?.should == true
response.should be_successful
end
end

View File

@ -21,7 +21,7 @@ describe Travis::Api::App::SettingsEndpoint do
json = JSON.parse(response.body)
json['env_var']['name'].should == 'FOO'
json['env_var']['id'].should == record.id
json['env_var']['public'].should be_false
json['env_var']['public'].should == false
json['env_var']['repository_id'].should == repo.id
json['env_var'].should_not have_key('value')
end
@ -47,7 +47,8 @@ describe Travis::Api::App::SettingsEndpoint do
key['name'].should == 'FOO'
key['id'].should == record.id
key['repository_id'].should == repo.id
key['public'].should be_false
key['public'].should == false
key.should_not have_key('value')
end
end
@ -165,7 +166,7 @@ describe Travis::Api::App::SettingsEndpoint do
json['env_var']['id'].should == env_var.id
json['env_var'].should_not have_key('value')
repo.reload.settings.env_vars.should have(0).env_vars
repo.reload.settings.env_vars.length.should == 0
end
it 'returns 404 if env_var can\'t be found' do

View File

@ -50,7 +50,7 @@ end
RSpec.configure do |c|
c.mock_framework = :mocha
c.expect_with :rspec, :stdlib
c.expect_with :rspec, :test_unit
c.include TestHelpers
c.before :suite do

View File

@ -49,7 +49,7 @@ describe Travis::Api::V2::Http::Build do
let(:data) { Travis::Api::V2::Http::Build.new(build).data }
it 'returns pull request data' do
data['build']['pull_request'].should be_true
data['build']['pull_request'].should == true
data['build']['pull_request_title'].should == 'A pull request'
data['build']['pull_request_number'].should == 44
end

View File

@ -56,7 +56,7 @@ describe Travis::Api::V2::Http::Builds do
end
it 'returns pull request data' do
data['builds'].first['pull_request'].should be_true
data['builds'].first['pull_request'].should == true
data['builds'].first['pull_request_number'].should == 44
end
end

View File

@ -30,11 +30,11 @@ describe Travis::Api::App::Endpoint::Authorization do
end
describe 'GET /auth/authorize' do
pending "not yet implemented"
skip "not yet implemented"
end
describe 'POST /auth/access_token' do
pending "not yet implemented"
skip "not yet implemented"
end
describe "GET /auth/handshake" do

View File

@ -40,7 +40,7 @@ describe Travis::Api::App::Endpoint::Users do
response = post('/users/sync', { access_token: access_token.to_s }, 'HTTP_ACCEPT' => 'application/vnd.travis-ci.2+json, */*; q=0.01')
response.status.should == 409
JSON.parse(response.body).should be_true
JSON.parse(response.body).should == { 'message' => 'Sync already in progress. Try again later.' }
end
end
end

View File

@ -47,23 +47,23 @@ module Travis::Api::App::Helpers
describe 'accepts?' do
it 'accepts everything with */* type' do
entry = Accept::Entry.new('*/*')
entry.accepts?('application/json').should be_true
entry.accepts?('foo/bar').should be_true
entry.accepts?('application/json').should == true
entry.accepts?('foo/bar').should == true
end
it 'accepts every subtype with application/* type' do
entry = Accept::Entry.new('application/*')
entry.accepts?('application/foo').should be_true
entry.accepts?('application/bar').should be_true
entry.accepts?('text/plain').should be_false
entry.accepts?('application/foo').should == true
entry.accepts?('application/bar').should == true
entry.accepts?('text/plain').should == false
end
it 'accepts when type and subtype match' do
entry = Accept::Entry.new('application/json')
entry.accepts?('application/json').should be_true
entry.accepts?('application/xml').should be_false
entry.accepts?('application/json').should == true
entry.accepts?('application/xml').should == false
end
end
end

View File

@ -14,7 +14,7 @@ module Travis::Api::App::Responders
context 'with resource not associated with Api data class' do
it 'returns nil result' do
json.apply.should be_false
json.apply.should be_nil
end
end
@ -31,8 +31,8 @@ module Travis::Api::App::Responders
let(:resource) { nil }
it 'responds with 404' do
json.apply?.should be_false
json.apply.should be_false
json.apply?.should be_falsey
json.apply.should be_falsey
end
end
end