首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何运行水豚sinatra

如何运行水豚sinatra
EN

Stack Overflow用户
提问于 2011-07-31 04:34:05
回答 2查看 704关注 0票数 0

我得到了一个样例sinatra项目,其中包含一个hello world,用于在akephalos中测试水豚。我通过查看代码来理解这个概念,但是我该如何运行它呢?如果我运行rackup config.ru,然后转到:9292,我只会看到一个hello world。太好了,这告诉我什么了?如何运行测试?该项目只是一个框架,但下面是一个名为example_spec.rb的文件。我如何才能看到它失败,例如,通过寻找"Hi world“并看着它失败?希望这是足够的信息。在我问给我提供测试的人之前,我想我应该在这里检查一下,谢谢!

代码语言:javascript
复制
# 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
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-08-03 10:02:14

bundle exec rspec spec,这意味着在"spec“目录上运行"bundle exec rspec”

票数 0
EN

Stack Overflow用户

发布于 2011-08-02 13:04:56

您需要设置Capybara.app = <your Sinatra class>。可能是这样的:

代码语言:javascript
复制
setup do
  Capybara.app = Main
end
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6885817

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档