Sha256: 3bd735400b347e00047932f1b33764c9eaac99b3602e6f329aaeb60ad5824078
Contents?: true
Size: 884 Bytes
Versions: 84
Compression:
Stored size: 884 Bytes
Contents
require 'rails_helper' describe User do # TODO: appmap/rspec doesn't handle shared_examples_for 100% correctly yet. # In my tests, only one of these two tests will be emitted as an appmap. shared_examples_for 'creates the user' do |username| let(:login) { username } let(:user) { User.new(login: login) } it "creates #{username.inspect}" do expect(user.save(raise_on_failure: true)).to be_truthy end end describe 'creation' do # So, instead of shared_examples_for, let's go with a simple method # containing the assertions. The method can be called from within an example. def save_and_verify expect(user.save(raise_on_failure: true)).to be_truthy end context do let(:login) { 'charles' } let(:user) { User.new(login: login) } it "creates 'charles'" do save_and_verify end end end end
Version data entries
84 entries across 84 versions & 1 rubygems