Using RSpec Block Syntax for Message Expectations

Like many test frameworks RSpec allows you to stub method implementations and to set expectations in your tests, to verify which methods should be invoked, and with what arguments. This is achieved using either the expect or allow syntax. By setting message expectations in this way our unit tests can assert that some dependency is called in the manner expected, without us having to worry about actually invoking the method on that dependency. For example:.
Using RSpec Block Syntax for Message Expectations #ruby #rubydeveloper #rubyonrails #rspec https://rubyonrails.ba/single/using-rspec-block-syntax-for-message-expectations

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles