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

Version Path
appmap-0.83.4 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.83.3 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.83.2 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.83.1 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.83.0 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.82.0 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.81.1 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.81.0 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.80.2 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.80.1 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.80.0 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.79.0 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.78.0 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.77.4 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.77.3 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.77.2 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.77.1 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.77.0 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.76.0 spec/fixtures/rails5_users_app/spec/models/user_spec.rb
appmap-0.75.0 spec/fixtures/rails5_users_app/spec/models/user_spec.rb