使用Rspec中的功能生成错误

时间:2015-10-21 03:45:47

标签: ruby rspec integration

我阅读了以下有关使用Rspec进行功能测试的文章:

https://about.futurelearn.com/blog/how-we-write-readable-feature-tests-with-rspec/

我在安装capybara gem后尝试了以下操作并出现错误:

=> schedule_kaya_spec.rb:9:in `<top (required)>': undefined method `feature' for RSpec:Module (NoMethodError)

这是我的代码:

RSpec.feature "Create recurring event and get slack via cron next day" , :type => :feature  do

    scenario "User creates a daily recurring event at 10AM PST" do

        given_a_user_has_created_a_recurring_slack_event_at_10_pst

        when_the_time_passes_10_pst_the_next_day

        then_send_a_slack_message

        and_update_next_occurrence_for_the_next_day

    end


    def given_a_user_has_created_a_recurring_slack_event_at_10_pst

        # set time to 10AM PST
        Time.zone = "America/Los_Angeles"
        Chronic.time_class = Time.zone
        Timecop.freeze(Chronic.parse("march 1, 2014 at 10AM")) 

        user_input = "xtest create recurring event at 10 AM PST everyday with keyword test reminder keyword"
        bot_client_id = 'test-client-id'

        bot_response = BotResponse.new(bot_client_id, user_input, "1000")

        bot_response.run

    end

问题: 1)如何使用下面的方法创建功能/场景测试? 2)有没有办法让feature更像描述,并且具有嵌套场景的多个功能?

0 个答案:

没有答案