if i have following lines in my spec
include Rack::Test::Methods
let(:competition_date) { Date.today+10.days }
How can i print the value of competition_date symbol in rspec?
if i have following lines in my spec
include Rack::Test::Methods
let(:competition_date) { Date.today+10.days }
How can i print the value of competition_date symbol in rspec?
在 RSpec 中,定义在let
中的变量可以在before
和it
块中访问。但是,所有内容都必须包含在一个describe
块中,如下所示:
describe "let variables" do
let(:competition_date) { Date.today+10.days }
it "should be accessible within it blocks" do
expect(competition_date).to be == Date.today+10.days
puts competition_date
end
end