Permalink
Browse files

+ Also update the specs

  • Loading branch information...
1 parent 61751a1 commit 78e02951afdde07157ea2776e9503fbf6addfa7d @floere committed Jan 25, 2013
Showing with 11 additions and 11 deletions.
  1. +11 −11 server/spec/integration/sinatra_index_actions_spec.rb
@@ -36,28 +36,28 @@ class MyIndexActionsPickyServer < Sinatra::Base
context 'return values' do
describe 'update' do
it 'returns a correct code after updating without problems' do
- result = request.post('/', params: {
+ result = request.put('/', params: {
index: 'some_index',
data: %Q{{ "id":"1", "name":"Florian", "surname":"Hanke" }}
})
result.status.should == 200
end
it 'returns a correct code after updating with just the id' do
- result = request.post('/', params: {
+ result = request.put('/', params: {
index: 'some_index',
data: %Q{{ "id":"1" }}
})
result.status.should == 200
end
it 'returns a correct code after updating without id' do
- result = request.post('/', params: {
+ result = request.put('/', params: {
index: 'some_index',
data: %Q{{ "name":"Florian", "surname":"Hanke" }}
})
result.status.should == 400
end
it 'returns a correct code after updating with the wrong index' do
- result = request.post('/', params: {
+ result = request.put('/', params: {
index: 'some_wrong_index',
data: %Q{{ "id":"1", "name":"Florian", "surname":"Hanke" }}
})
@@ -107,15 +107,15 @@ class MyIndexActionsPickyServer < Sinatra::Base
end
context '' do
it 'updates the index correctly' do
- request.post('/', params: {
+ request.put('/', params: {
index: 'some_index',
data: %Q{{ "id":"1", "name":"Florian", "surname":"Hanke" }}
})
results = MultiJson.decode request.get('/people', params: { query: 'florian' }).body
results['total'].should == 1
- request.post('/', params: {
+ request.put('/', params: {
index: 'some_index',
data: %Q{{ "id":"2", "name":"Florian", "surname":"Meier" }}
})
@@ -124,7 +124,7 @@ class MyIndexActionsPickyServer < Sinatra::Base
results['total'].should == 2
end
it 'updates the index correctly' do
- request.post('/', params: {
+ request.put('/', params: {
index: 'some_index',
data: %Q{{ "id":"1", "name":"Flarian", "surname":"Hanke" }}
})
@@ -137,7 +137,7 @@ class MyIndexActionsPickyServer < Sinatra::Base
# Whoops, typo. Let's fix it.
#
- request.post('/', params: {
+ request.put('/', params: {
index: 'some_index',
data: %Q{{ "id":"1", "name":"Florian", "surname":"Hanke" }}
})
@@ -152,11 +152,11 @@ class MyIndexActionsPickyServer < Sinatra::Base
results['total'].should == 1
end
it 'deletes entries from the index correctly' do
- request.post('/', params: {
+ request.put('/', params: {
index: 'some_index',
data: %Q{{ "id":"1", "name":"Florian", "surname":"Hanke" }}
})
- request.post('/', params: {
+ request.put('/', params: {
index: 'some_index',
data: %Q{{ "id":"2", "name":"Florian", "surname":"Meier" }}
})
@@ -184,7 +184,7 @@ class MyIndexActionsPickyServer < Sinatra::Base
it 'works with the (test) client' do
client = Picky::TestClient.new MyIndexActionsPickyServer, :path => '/people'
- request.post('/', params: {
+ request.put('/', params: {
index: 'some_index',
data: %Q{{ "id":"1", "name":"Florian", "surname":"Hanke" }}
})

0 comments on commit 78e0295

Please sign in to comment.