小编dig*_*jim的帖子

如何让水豚通过标签选中复选框

水豚没有找到我的复选框的标签,而且我知道我通过它的标签正确引用了它。我做错了什么,还是这是水豚的一个错误?

根据http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Actions:check,“可以通过名称、ID 或标签文本找到该复选框。”

这是我运行的请求规范的部分:

describe "with valid information" do   

it_should_behave_like "all item pages"

before { valid_create_item }

it "should create an item" do
    expect { click_button submit }.to change(Item, :count).by(1)
end

describe "after saving the item" do
    before { click_button submit }

    it { should have_link('Sign out') }
    it { should have_selector('h1', text: "Items") }
    it { should have_title("Items") }
    it { should have_success_message }
end      

describe "and options selected" do

    before do
        puts page.html
        check('Option 1')
        click_button …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails capybara rspec-rails

5
推荐指数
1
解决办法
1万
查看次数

无法解决 clojure.string/replace“不是函数”错误

这是 ClojureScript 的字符串“替换”函数的原始代码块:

(defn replace
  "Replaces all instance of match with replacement in s.
  match/replacement can be:
  string / string
  pattern / (string or function of match)."
 [s match replacement]
 (cond
   (string? match)
   (.replace s (js/RegExp. (gstring/regExpEscape match) "g") replacement)

   (instance? js/RegExp match)
   (if (string? replacement)
     (replace-all s match replacement)
     (replace-all s match (replace-with replacement)))

   :else (throw (str "Invalid match arg: " match))))
Run Code Online (Sandbox Code Playgroud)

正如您在这一行中看到的:[s match replacement],此方法接受三个参数。

从我的 REPL:

user=> (replace ":c41120" ":" "")

ArityException Wrong number of args …
Run Code Online (Sandbox Code Playgroud)

replace clojurescript

3
推荐指数
2
解决办法
864
查看次数