Fixes
- Fix typo for expectations
- Changelog for #225
- v3.13.5
- Trigger build
- surpress rubocop rule for == methodname
- Changelog for #121
- v3.13.5
- Remove un-needed rubocop rule for 3.13
This is the RSpec mono repo, it contains the core gems we think of as "rspec", they are:
This is the RSpec mono repo, it contains the core gems we think of as "rspec", they are:
rspec-core provides the structure for writing executable examples of how your
code should behave, and an rspec command with tools to constrain which
examples get run and tailor the output.
rspec-expectations lets you express expected outcomes on an object in an example.
rspec-mocks is a test-double framework for rspec with support for method stubs,
fakes, and message expectations on generated test-doubles and real objects
alike.
rspec-support provides shared helper functionality for the other three gems, in
general you don't install this on its own.
gem install rspec # for rspec-core, rspec-expectations and rspec-mocksgem install rspec-core # for rspec-core onlygem install rspec-expectations # for rspec-expectations onlygem install rspec-mocks # for rspec-mocks onlyWant to run against the main branch? You'll need to include the dependent
RSpec repos as well. Add the following to your Gemfile:
%w[rspec rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib| if lib == 'rspec' gem lib, git: "https://github.com/rspec/rspec" else gem lib, git: "https://github.com/rspec/rspec", glob: "#{lib}/#{lib}.gemspec" endendrspec CommandIf you install the rspec-core gem, it installs the rspec executable,
which you'll use to run rspec. The rspec command comes with many useful
options.
Run rspec --help to see the complete list.
RSpec uses the words "describe" and "it" so we can express concepts like a conversation:
"Describe a calculator.""It adds together numbers."e.g.
# in spec/calculator_spec.rbRSpec.describe Calculator do describe '#add' do it 'returns the sum of its arguments' do expect(Calculator.new.add(1, 2)).to eq(3) end endendRun this with the rspec command, and watch it fail:
$ rspec spec/calculator_spec.rb./spec/calculator_spec.rb:1: uninitialized constant CalculatorAddress the failure by defining a skeleton of the Calculator class:
# in lib/calculator.rbclass Calculator def add(a, b) endendBe sure to require the implementation file in the spec:
# in spec/calculator_spec.rb# - RSpec adds ./lib to the $LOAD_PATHrequire "calculator"Now run the spec again, and watch the expectation fail:
$ rspec spec/calculator_spec.rbFFailures: 1) Calculator#add returns the sum of its arguments Failure/Error: expect(Calculator.new.add(1, 2)).to eq(3) expected: 3 got: nil (compared using ==) # ./spec/calculator_spec.rb:6:in `block (3 levels) in <top (required)>'Finished in 0.00131 seconds (files took 0.10968 seconds to load)1 example, 1 failureFailed examples:rspec ./spec/calculator_spec.rb:5 # Calculator#add returns the sum of its argumentsImplement the simplest solution, by changing the definition of Calculator#add to:
def add(a, b) a + bendNow run the spec again, and watch it pass:
$ rspec spec/calculator_spec.rb.Finished in 0.000315 seconds1 example, 0 failuresUse the documentation formatter to see the resulting spec:
$ rspec spec/calculator_spec.rb --format docCalculator #add returns the sum of its argumentsFinished in 0.000379 seconds1 example, 0 failuresOnce you've set up the environment, you'll need to cd into the working directory of whichever repo you want to work in. From there you can run the specs and cucumber features, and make patches.
Оберіть дві версії з changelog notes щоб переглянути зміни.
Тут показані лише релізи, для яких є changelog notes.