Skip to content

Commit

Permalink
Adds spec for params handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDM committed Dec 1, 2013
1 parent 5030c47 commit 71a05c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/llt/segmenter/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Api < Sinatra::Base

get '/segment' do
text = params[:text].to_s
segmenter = LLT::Segmenter.new
segmenter = LLT::Segmenter.new(params)
sentences = segmenter.segment(text)

respond_to do |f|
Expand Down
11 changes: 11 additions & 0 deletions spec/lib/llt/segmenter/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ def app
body.should =~ /<s>homo mittit\.<\/s>/
body.should =~ /<s>Marcus est\.<\/s>/
end

it "receives params for segmentation and markup" do
params = { indexing: true }.merge(text)

get '/segment', params,
{"HTTP_ACCEPT" => "application/xml"}
last_response.should be_ok
body = last_response.body
body.should =~ /<s n="1">homo mittit\.<\/s>/
body.should =~ /<s n="2">Marcus est\.<\/s>/
end
end
end
end
Expand Down

0 comments on commit 71a05c1

Please sign in to comment.