rspec-expectations

Get the actual value of a boolean attribute

南笙酒味 提交于 2020-01-06 01:30:23
问题 I have the span: <span disabled="disabled">Edit Member</span> When I try to get the value of the disabled attribute: page.in_iframe(:id => 'MembersAreaFrame') do |frame| expect(page.span_element(:xpath => "//span[text()='Edit Member']", :frame => frame).attribute('disabled')).to eq("disabled") end I get: expected: "disabled" got: "true" How do I get the value of specified attribute instead of a boolean value? 回答1: The Page-Object gem's attribute method does not do any formatting of the

rspec: undefined local variable or method `be_true'

自作多情 提交于 2019-12-22 13:48:31
问题 I am using rspec 2.4.0 and cucumber 0.6.4. I am running a simple scenario (for the sake of this question): Scenario: Simple Test When I test something with step definition: require 'rspec' require 'rspec/expectations' When /^I test something$/ do result = (1==1) result.should be_true end When I run this scenario I get the following problems: undefined local variable or method `be_true' for #<Object:0x1b3b424> (NameError) I am also using bundler to manage my dependencies. Am I doing something

rspec: undefined local variable or method `be_true'

核能气质少年 提交于 2019-12-06 08:12:19
I am using rspec 2.4.0 and cucumber 0.6.4. I am running a simple scenario (for the sake of this question): Scenario: Simple Test When I test something with step definition: require 'rspec' require 'rspec/expectations' When /^I test something$/ do result = (1==1) result.should be_true end When I run this scenario I get the following problems: undefined local variable or method `be_true' for #<Object:0x1b3b424> (NameError) I am also using bundler to manage my dependencies. Am I doing something obviously wrong here? Regards, Mark From the cucumber documentation: To use RSpec’s 2.x.x expectations

How to use RSpec expectations in irb

落花浮王杯 提交于 2019-11-29 02:52:36
问题 I'd want to use [1,2,3].should include(1) in irb. I tried: ~$ irb 1.9.3p362 :001 > require 'rspec/expectations' => true 1.9.3p362 :002 > include RSpec::Matchers => Object 1.9.3p362 :003 > [1,2,3].should include(1) TypeError: wrong argument type Fixnum (expected Module) from (irb):3:in `include' from (irb):3 from /home/andrey/.rvm/rubies/ruby-1.9.3-p362/bin/irb:16:in `<main>' But it doesn't work though it's a valid case. How can I use [1,2,3].should include(1) ? 回答1: You are close, but calling