Skip to content

Instantly share code, notes, and snippets.

@paul
Created September 25, 2008 16:52
Show Gist options
  • Save paul/12859 to your computer and use it in GitHub Desktop.
Save paul/12859 to your computer and use it in GitHub Desktop.
describe 'creating a article by web services' do
before do
@result = post('/articles', '{ "title": "My Article", "text": "Lorem Ipsum" }', :content_type => 'application/json')
@article_uri = @result.header['Location']
id = parse_route(@article_uri)[:id]
@article = Article.get(id)
end
it 'should be successful' do
@result.should be_success
end
it 'should give the location of the article' do
@article_uri.should_not be_nil
@article_uri.should =~ %r{/articles/\d+}
end
it 'should set the title' do
@article.title.should == "My Article"
end
it 'should set the text'
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment