我得到了一个样例sinatra项目,其中包含一个hello world,用于在akephalos中测试水豚。我通过查看代码来理解这个概念,但是我该如何运行它呢?如果我运行rackup config.ru,然后转到:9292,我只会看到一个hello world。太好了,这告诉我什么了?如何运行测试?该项目只是一个框架,但下面是一个名为example_spec.rb的文件。我如何才能看到它失败,例如,通过寻找"Hi world“并看着它失败?希望这是足够的信息。在我问给我提供测试的人之前,我想我应该在这里检查一下,谢谢!
# describe and context blocks are optional but help organize things
describe 'the index page' do
include x
# :js => true is used to run the test in Firefox. Otherwise it runs headless
# and without JS support
it 'can view the index page', :js => true do
visit '/'
# check to see if the page has the following text (ignoring tags)
page.should have_content('Hello, world!')
# visit https://github.com/jnicklas/capybara to see a complete list of
# assertions
end发布于 2011-08-03 10:02:14
bundle exec rspec spec,这意味着在"spec“目录上运行"bundle exec rspec”
发布于 2011-08-02 13:04:56
您需要设置Capybara.app = <your Sinatra class>。可能是这样的:
setup do
Capybara.app = Main
endhttps://stackoverflow.com/questions/6885817
复制相似问题