appmap 0.35.2 → 0.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +1 -1
- data/.gitignore +2 -1
- data/.rubocop.yml +15 -1
- data/.travis.yml +0 -7
- data/CHANGELOG.md +22 -0
- data/README.md +24 -12
- data/Rakefile +3 -2
- data/appmap.gemspec +2 -1
- data/appmap.yml +1 -7
- data/lib/appmap.rb +2 -2
- data/lib/appmap/class_map.rb +20 -6
- data/lib/appmap/config.rb +66 -22
- data/lib/appmap/event.rb +16 -1
- data/lib/appmap/hook/method.rb +18 -12
- data/lib/appmap/rails/request_handler.rb +20 -4
- data/lib/appmap/railtie.rb +1 -1
- data/lib/appmap/rspec.rb +1 -1
- data/lib/appmap/trace.rb +18 -7
- data/lib/appmap/version.rb +2 -2
- data/spec/abstract_controller4_base_spec.rb +27 -28
- data/spec/abstract_controller_base_spec.rb +132 -67
- data/spec/class_map_spec.rb +36 -0
- data/spec/fixtures/hook/instance_method.rb +4 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.dockerignore +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.gitignore +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/.rspec +0 -0
- data/{.ruby-version → spec/fixtures/rails5_users_app/.ruby-version} +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/Dockerfile +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/Dockerfile.pg +0 -0
- data/spec/fixtures/rails5_users_app/Gemfile +51 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/Rakefile +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/api/users_controller.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/application_controller.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/concerns/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/controllers/health_controller.rb +0 -0
- data/spec/fixtures/rails5_users_app/app/controllers/users_controller.rb +13 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/models/activerecord/user.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/models/concerns/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/models/sequel/user.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/views/layouts/application.html.haml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/app/views/users/index.html.haml +0 -0
- data/spec/fixtures/rails5_users_app/appmap.yml +4 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/appmap +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/byebug +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/gli +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/htmldiff +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ldiff +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/nokogiri +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rackup +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rails +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rake +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/rspec +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ruby-parse +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/ruby-rewrite +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/sequel +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/setup +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/sprockets +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/thor +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/bin/update +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config.ru +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/application.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/boot.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/credentials.yml.enc +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/database.yml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environment.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/development.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/production.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/environments/test.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/application_controller_renderer.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/cors.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/inflections.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/mime_types.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/record_button.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/initializers/wrap_parameters.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/locales/en.yml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/config/routes.rb +1 -1
- data/spec/fixtures/{rails_users_app → rails5_users_app}/create_app +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/db/migrate/20190728211408_create_users.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/db/schema.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/docker-compose.yml +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/api_users.feature +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/env.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/hooks.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/features/support/steps.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/lib/tasks/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/log/.keep +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/public/robots.txt +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/controllers/users_controller_api_spec.rb +1 -1
- data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb +27 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/models/user_spec.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/rails_helper.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/spec/spec_helper.rb +0 -0
- data/spec/fixtures/{rails_users_app → rails5_users_app}/users_app/.gitignore +0 -0
- data/spec/fixtures/rails6_users_app/.dockerignore +1 -0
- data/spec/fixtures/rails6_users_app/.gitignore +39 -0
- data/spec/fixtures/rails6_users_app/.rspec +1 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/.ruby-version +0 -0
- data/spec/fixtures/rails6_users_app/Dockerfile +29 -0
- data/spec/fixtures/rails6_users_app/Dockerfile.pg +3 -0
- data/spec/fixtures/{rails_users_app → rails6_users_app}/Gemfile +1 -1
- data/spec/fixtures/rails6_users_app/Rakefile +6 -0
- data/spec/fixtures/rails6_users_app/app/controllers/api/users_controller.rb +27 -0
- data/spec/fixtures/rails6_users_app/app/controllers/application_controller.rb +2 -0
- data/spec/fixtures/rails6_users_app/app/controllers/concerns/.keep +0 -0
- data/spec/fixtures/rails6_users_app/app/controllers/health_controller.rb +5 -0
- data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +13 -0
- data/spec/fixtures/rails6_users_app/app/models/activerecord/user.rb +18 -0
- data/spec/fixtures/rails6_users_app/app/models/concerns/.keep +0 -0
- data/spec/fixtures/rails6_users_app/app/models/sequel/user.rb +25 -0
- data/spec/fixtures/rails6_users_app/app/views/layouts/application.html.haml +7 -0
- data/spec/fixtures/rails6_users_app/app/views/users/index.html.haml +7 -0
- data/spec/fixtures/rails6_users_app/appmap.yml +5 -0
- data/spec/fixtures/rails6_users_app/bin/appmap +29 -0
- data/spec/fixtures/rails6_users_app/bin/byebug +29 -0
- data/spec/fixtures/rails6_users_app/bin/gli +29 -0
- data/spec/fixtures/rails6_users_app/bin/htmldiff +29 -0
- data/spec/fixtures/rails6_users_app/bin/ldiff +29 -0
- data/spec/fixtures/rails6_users_app/bin/nokogiri +29 -0
- data/spec/fixtures/rails6_users_app/bin/rackup +29 -0
- data/spec/fixtures/rails6_users_app/bin/rails +4 -0
- data/spec/fixtures/rails6_users_app/bin/rake +29 -0
- data/spec/fixtures/rails6_users_app/bin/rspec +29 -0
- data/spec/fixtures/rails6_users_app/bin/ruby-parse +29 -0
- data/spec/fixtures/rails6_users_app/bin/ruby-rewrite +29 -0
- data/spec/fixtures/rails6_users_app/bin/sequel +29 -0
- data/spec/fixtures/rails6_users_app/bin/setup +25 -0
- data/spec/fixtures/rails6_users_app/bin/sprockets +29 -0
- data/spec/fixtures/rails6_users_app/bin/thor +29 -0
- data/spec/fixtures/rails6_users_app/bin/update +25 -0
- data/spec/fixtures/rails6_users_app/config.ru +5 -0
- data/spec/fixtures/rails6_users_app/config/application.rb +51 -0
- data/spec/fixtures/rails6_users_app/config/boot.rb +3 -0
- data/spec/fixtures/rails6_users_app/config/credentials.yml.enc +1 -0
- data/spec/fixtures/rails6_users_app/config/database.yml +18 -0
- data/spec/fixtures/rails6_users_app/config/environment.rb +5 -0
- data/spec/fixtures/rails6_users_app/config/environments/development.rb +40 -0
- data/spec/fixtures/rails6_users_app/config/environments/production.rb +68 -0
- data/spec/fixtures/rails6_users_app/config/environments/test.rb +36 -0
- data/spec/fixtures/rails6_users_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/fixtures/rails6_users_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails6_users_app/config/initializers/cors.rb +16 -0
- data/spec/fixtures/rails6_users_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/fixtures/rails6_users_app/config/initializers/inflections.rb +16 -0
- data/spec/fixtures/rails6_users_app/config/initializers/mime_types.rb +4 -0
- data/spec/fixtures/rails6_users_app/config/initializers/record_button.rb +3 -0
- data/spec/fixtures/rails6_users_app/config/initializers/wrap_parameters.rb +9 -0
- data/spec/fixtures/rails6_users_app/config/locales/en.yml +33 -0
- data/spec/fixtures/rails6_users_app/config/routes.rb +11 -0
- data/spec/fixtures/rails6_users_app/create_app +27 -0
- data/spec/fixtures/rails6_users_app/db/migrate/20190728211408_create_users.rb +9 -0
- data/spec/fixtures/rails6_users_app/db/schema.rb +23 -0
- data/spec/fixtures/rails6_users_app/docker-compose.yml +28 -0
- data/spec/fixtures/rails6_users_app/features/api_users.feature +13 -0
- data/spec/fixtures/rails6_users_app/features/support/env.rb +4 -0
- data/spec/fixtures/rails6_users_app/features/support/hooks.rb +11 -0
- data/spec/fixtures/rails6_users_app/features/support/steps.rb +18 -0
- data/spec/fixtures/rails6_users_app/lib/tasks/.keep +0 -0
- data/spec/fixtures/rails6_users_app/log/.keep +0 -0
- data/spec/fixtures/rails6_users_app/public/robots.txt +1 -0
- data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb +29 -0
- data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb +27 -0
- data/spec/fixtures/rails6_users_app/spec/models/user_spec.rb +39 -0
- data/spec/fixtures/rails6_users_app/spec/rails_helper.rb +66 -0
- data/spec/fixtures/rails6_users_app/spec/spec_helper.rb +96 -0
- data/spec/fixtures/rails6_users_app/users_app/.gitignore +20 -0
- data/spec/hook_spec.rb +103 -22
- data/spec/rails_spec_helper.rb +5 -5
- data/spec/railtie_spec.rb +31 -32
- data/spec/record_sql_rails4_pg_spec.rb +47 -48
- data/spec/record_sql_rails_pg_spec.rb +62 -63
- data/spec/remote_recording_spec.rb +90 -89
- data/spec/rspec_feature_metadata_spec.rb +17 -18
- data/test/expectations/openssl_test_key_sign1.json +55 -0
- data/test/expectations/openssl_test_key_sign2.json +58 -0
- data/test/fixtures/gem_test/Gemfile +6 -0
- data/test/fixtures/gem_test/appmap.yml +3 -0
- data/test/fixtures/gem_test/test/to_param_test.rb +14 -0
- data/test/gem_test.rb +34 -0
- data/test/minitest_test.rb +2 -2
- data/test/openssl_test.rb +10 -117
- metadata +173 -80
- data/spec/fixtures/rails_users_app/app/controllers/users_controller.rb +0 -5
- data/spec/fixtures/rails_users_app/appmap.yml +0 -3
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -e
|
3
|
+
|
4
|
+
# Just checking for a healthy container isn't enough, apparently. If
|
5
|
+
# we don't wait here, sometimes the database is inaccessible.
|
6
|
+
for i in {1..10}; do
|
7
|
+
psql -h pg -U postgres postgres -c 'select 1' >/dev/null 2>&1 && break
|
8
|
+
printf ' .'
|
9
|
+
sleep 1
|
10
|
+
done
|
11
|
+
echo
|
12
|
+
out="$(psql -h pg -U postgres postgres -c 'select 1' 2>&1)"
|
13
|
+
if [[ $? != 0 ]]; then
|
14
|
+
echo "Postgres didn't start in time:"
|
15
|
+
echo "$out"
|
16
|
+
exit 1
|
17
|
+
fi
|
18
|
+
|
19
|
+
psql -h pg -U postgres -c "create database app_development"
|
20
|
+
psql -h pg -U postgres -c "create database app_test"
|
21
|
+
|
22
|
+
set -e
|
23
|
+
|
24
|
+
RAILS_ENV=development ./bin/rake db:migrate
|
25
|
+
RAILS_ENV=test ./bin/rake db:migrate
|
26
|
+
|
27
|
+
echo "INSERT INTO users ( login ) VALUES ( 'admin' ) " | psql -h pg -U postgres app_development
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
change do
|
3
|
+
create_table(:schema_migrations) do
|
4
|
+
column :filename, "text", :null=>false
|
5
|
+
|
6
|
+
primary_key [:filename]
|
7
|
+
end
|
8
|
+
|
9
|
+
create_table(:users) do
|
10
|
+
primary_key :id
|
11
|
+
column :login, "text", :null=>false
|
12
|
+
column :password_digest, "bytea"
|
13
|
+
|
14
|
+
index [:login], :name=>:users_login_key, :unique=>true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
Sequel.migration do
|
19
|
+
change do
|
20
|
+
self << "SET search_path TO \"$user\", public"
|
21
|
+
self << "INSERT INTO \"schema_migrations\" (\"filename\") VALUES ('20190728211408_create_users.rb')"
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
version: "3"
|
2
|
+
services:
|
3
|
+
pg:
|
4
|
+
build:
|
5
|
+
context: .
|
6
|
+
dockerfile: Dockerfile.pg
|
7
|
+
ports:
|
8
|
+
- "5432"
|
9
|
+
environment:
|
10
|
+
POSTGRES_HOST_AUTH_METHOD: trust
|
11
|
+
|
12
|
+
app:
|
13
|
+
build:
|
14
|
+
context: .
|
15
|
+
dockerfile: Dockerfile
|
16
|
+
image: rails-app:${RUBY_VERSION}
|
17
|
+
command:
|
18
|
+
[ "./bin/rails", "server", "-b", "0.0.0.0", "webrick" ]
|
19
|
+
environment:
|
20
|
+
RAILS_ENV:
|
21
|
+
ORM_MODULE:
|
22
|
+
APPMAP:
|
23
|
+
volumes:
|
24
|
+
- .:/src/app
|
25
|
+
ports:
|
26
|
+
- "3000"
|
27
|
+
links:
|
28
|
+
- pg:pg
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: /api/users
|
2
|
+
|
3
|
+
@appmap-disable
|
4
|
+
Scenario: A user can be created
|
5
|
+
When I create a user
|
6
|
+
Then the response status should be 201
|
7
|
+
|
8
|
+
Scenario: When a user is created, it should be in the user list
|
9
|
+
Given I create a user
|
10
|
+
And the response status should be 201
|
11
|
+
When I list the users
|
12
|
+
Then the response status should be 200
|
13
|
+
And the response should include the user
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
When 'I create a user' do
|
4
|
+
@response = post '/api/users', login: 'alice'
|
5
|
+
end
|
6
|
+
|
7
|
+
Then(/the response status should be (\d+)/) do |status|
|
8
|
+
expect(@response.status).to eq(status.to_i)
|
9
|
+
end
|
10
|
+
|
11
|
+
When 'I list the users' do
|
12
|
+
@response = get '/api/users'
|
13
|
+
@users = JSON.parse(@response.body)
|
14
|
+
end
|
15
|
+
|
16
|
+
Then 'the response should include the user' do
|
17
|
+
expect(@users.map { |u| u['login'] }).to include('alice')
|
18
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
require 'rack/test'
|
3
|
+
|
4
|
+
RSpec.describe Api::UsersController, feature_group: 'Users', type: :controller, appmap: true do
|
5
|
+
describe 'POST /api/users', feature: 'Create a user' do
|
6
|
+
describe 'with required parameters' do
|
7
|
+
it 'creates a user' do
|
8
|
+
post :create, params: { login: 'alice', password: 'foobar' }
|
9
|
+
expect(response.status).to eq(201)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
describe 'with a missing parameter' do
|
13
|
+
it 'reports error 422' do
|
14
|
+
post :create, params: {}
|
15
|
+
expect(response.status).to eq(422)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
describe 'GET /api/users', feature: 'List users' do
|
20
|
+
before do
|
21
|
+
post :create, params: { login: 'alice' }
|
22
|
+
end
|
23
|
+
it 'lists the users' do
|
24
|
+
get :index, params: {}
|
25
|
+
users = JSON.parse(response.body)
|
26
|
+
expect(users.map { |r| r['login'] }).to include('alice')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
require 'rack/test'
|
3
|
+
|
4
|
+
RSpec.describe UsersController, type: :controller do
|
5
|
+
render_views
|
6
|
+
|
7
|
+
describe 'GET /users', feature: 'Show all users' do
|
8
|
+
before do
|
9
|
+
User.create login: 'alice'
|
10
|
+
end
|
11
|
+
it 'lists the users' do
|
12
|
+
get :index
|
13
|
+
expect(response).to be_ok
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'GET /users/:login', feature: 'Show a user' do
|
18
|
+
before do
|
19
|
+
User.create login: 'alice'
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'shows the user' do
|
23
|
+
get :show, params: { id: 'alice' }
|
24
|
+
expect(response).to be_ok
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe User, feature_group: 'User', appmap: true do
|
4
|
+
# TODO: appmap/rspec doesn't handle shared_examples_for 100% correctly yet.
|
5
|
+
# In my tests, only one of these two tests will be emitted as an appmap.
|
6
|
+
shared_examples_for 'creates the user' do |username|
|
7
|
+
let(:login) { username }
|
8
|
+
let(:user) { User.new(login: login) }
|
9
|
+
it "creates #{username.inspect}" do
|
10
|
+
expect(user.save(raise_on_failure: true)).to be_truthy
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'creation', feature: 'Create a user' do
|
15
|
+
context 'using shared_examples_for' do
|
16
|
+
# AppMap.
|
17
|
+
# context "with username 'alice'" do
|
18
|
+
# it_should_behave_like 'creates the user', 'alice'
|
19
|
+
# end
|
20
|
+
# context "with username 'bob'" do
|
21
|
+
# it_should_behave_like 'creates the user', 'bob'
|
22
|
+
# end
|
23
|
+
end
|
24
|
+
|
25
|
+
# So, instead of shared_examples_for, let's go with a simple method
|
26
|
+
# containing the assertions. The method can be called from within an example.
|
27
|
+
def save_and_verify
|
28
|
+
expect(user.save(raise_on_failure: true)).to be_truthy
|
29
|
+
end
|
30
|
+
|
31
|
+
context do
|
32
|
+
let(:login) { 'charles' }
|
33
|
+
let(:user) { User.new(login: login) }
|
34
|
+
it "creates 'charles'" do
|
35
|
+
save_and_verify
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
require 'spec_helper'
|
3
|
+
ENV['RAILS_ENV'] ||= 'test'
|
4
|
+
require File.expand_path('../../config/environment', __FILE__)
|
5
|
+
# Prevent database truncation if the environment is production
|
6
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
7
|
+
require 'rspec/rails'
|
8
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
9
|
+
|
10
|
+
require 'appmap/rspec'
|
11
|
+
|
12
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
13
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
14
|
+
# run as spec files by default. This means that files in spec/support that end
|
15
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
16
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
17
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
18
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
19
|
+
#
|
20
|
+
# The following line is provided for convenience purposes. It has the downside
|
21
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
22
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
23
|
+
# require only the support files necessary.
|
24
|
+
#
|
25
|
+
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
|
26
|
+
|
27
|
+
RSpec.configure do |config|
|
28
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
29
|
+
# based on their file location, for example enabling you to call `get` and
|
30
|
+
# `post` in specs under `spec/controllers`.
|
31
|
+
#
|
32
|
+
# You can disable this behaviour by removing the line below, and instead
|
33
|
+
# explicitly tag your specs with their type, e.g.:
|
34
|
+
#
|
35
|
+
# RSpec.describe UsersController, :type => :controller do
|
36
|
+
# # ...
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# The different available types are documented in the features, such as in
|
40
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
41
|
+
config.infer_spec_type_from_file_location!
|
42
|
+
|
43
|
+
# Filter lines from Rails gems in backtraces.
|
44
|
+
config.filter_rails_from_backtrace!
|
45
|
+
# arbitrary gems may also be filtered via:
|
46
|
+
# config.filter_gems_from_backtrace("gem name")
|
47
|
+
|
48
|
+
|
49
|
+
DatabaseCleaner.allow_remote_database_url = true
|
50
|
+
|
51
|
+
config.before(:suite) do
|
52
|
+
DatabaseCleaner.strategy = :transaction
|
53
|
+
DatabaseCleaner.clean_with(:truncation)
|
54
|
+
end
|
55
|
+
|
56
|
+
config.around :each do |example|
|
57
|
+
# Enable the use of 'return' from a guard
|
58
|
+
-> {
|
59
|
+
return example.run unless %i[model controller].member?(example.metadata[:type])
|
60
|
+
|
61
|
+
DatabaseCleaner.cleaning do
|
62
|
+
example.run
|
63
|
+
end
|
64
|
+
}.call
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
|
+
RSpec.configure do |config|
|
17
|
+
# rspec-expectations config goes here. You can use an alternate
|
18
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
19
|
+
# assertions if you prefer.
|
20
|
+
config.expect_with :rspec do |expectations|
|
21
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
22
|
+
# and `failure_message` of custom matchers include text for helper methods
|
23
|
+
# defined using `chain`, e.g.:
|
24
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
25
|
+
# # => "be bigger than 2 and smaller than 4"
|
26
|
+
# ...rather than:
|
27
|
+
# # => "be bigger than 2"
|
28
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
29
|
+
end
|
30
|
+
|
31
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
32
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
33
|
+
config.mock_with :rspec do |mocks|
|
34
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
35
|
+
# a real object. This is generally recommended, and will default to
|
36
|
+
# `true` in RSpec 4.
|
37
|
+
mocks.verify_partial_doubles = true
|
38
|
+
end
|
39
|
+
|
40
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
41
|
+
# have no way to turn it off -- the option exists only for backwards
|
42
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
43
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
44
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
45
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
46
|
+
|
47
|
+
# The settings below are suggested to provide a good initial experience
|
48
|
+
# with RSpec, but feel free to customize to your heart's content.
|
49
|
+
=begin
|
50
|
+
# This allows you to limit a spec run to individual examples or groups
|
51
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
52
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
53
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
54
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
55
|
+
config.filter_run_when_matching :focus
|
56
|
+
|
57
|
+
# Allows RSpec to persist some state between runs in order to support
|
58
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
59
|
+
# you configure your source control system to ignore this file.
|
60
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
61
|
+
|
62
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
63
|
+
# recommended. For more details, see:
|
64
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
65
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
66
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
67
|
+
config.disable_monkey_patching!
|
68
|
+
|
69
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
70
|
+
# file, and it's useful to allow more verbose output when running an
|
71
|
+
# individual spec file.
|
72
|
+
if config.files_to_run.one?
|
73
|
+
# Use the documentation formatter for detailed output,
|
74
|
+
# unless a formatter has already been configured
|
75
|
+
# (e.g. via a command-line flag).
|
76
|
+
config.default_formatter = "doc"
|
77
|
+
end
|
78
|
+
|
79
|
+
# Print the 10 slowest examples and example groups at the
|
80
|
+
# end of the spec run, to help surface which specs are running
|
81
|
+
# particularly slow.
|
82
|
+
config.profile_examples = 10
|
83
|
+
|
84
|
+
# Run specs in random order to surface order dependencies. If you find an
|
85
|
+
# order dependency and want to debug it, you can fix the order by providing
|
86
|
+
# the seed, which is printed after each run.
|
87
|
+
# --seed 1234
|
88
|
+
config.order = :random
|
89
|
+
|
90
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
91
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
92
|
+
# test failures related to randomization by passing the same `--seed` value
|
93
|
+
# as the one that triggered the failure.
|
94
|
+
Kernel.srand config.seed
|
95
|
+
=end
|
96
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore all logfiles and tempfiles.
|
11
|
+
/log/*
|
12
|
+
/tmp/*
|
13
|
+
!/log/.keep
|
14
|
+
!/tmp/.keep
|
15
|
+
|
16
|
+
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
# Ignore master key for decrypting credentials and more.
|
20
|
+
/config/master.key
|