Improving specs with RSpec 3
17
Improving specs with RSpec 3 A talk for @globaldev by @jamesjoshuahill
-
Upload
josh-hill -
Category
Technology
-
view
526 -
download
2
Transcript of Improving specs with RSpec 3
config.mock_with :rspec do |mocks|
# Protect against typos
mocks.verify_doubled_constant_names = true
# Will be a default in RSpec 4
mocks.verify_partial_doubles = true
end
expect(data).to match(
:answer => a_value_within(0.1).of(42),
:message => a_string_starting_with(“hi”) .and ending_with(“bye”)
)
subject { app }
# Bundle rspec-its gem to use old syntax
its(:data) { should eq “hello” }
!
!
!
!
!
!
# Or convert examples manually
it “returns the data” do expect(subject.data).to eq “hello” end