git_models 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/.dependabot/config.yml +10 -0
  3. data/.github/workflows/gem_release.yml +37 -0
  4. data/.gitignore +61 -0
  5. data/.jenkins/Jenkinsfile +80 -0
  6. data/.jenkins/ruby_build_pod.yml +18 -0
  7. data/.rspec +3 -0
  8. data/.rubocop.yml +51 -0
  9. data/Appraisals +14 -0
  10. data/CHANGELOG.md +25 -0
  11. data/Gemfile +25 -0
  12. data/Gemfile.lock +237 -0
  13. data/README.md +6 -0
  14. data/Rakefile +28 -0
  15. data/app/models/concerns/branch.rb +55 -0
  16. data/app/models/concerns/commit.rb +44 -0
  17. data/app/models/concerns/repository.rb +28 -0
  18. data/app/models/concerns/user.rb +33 -0
  19. data/gemfiles/.bundle/config +2 -0
  20. data/gemfiles/rails_4.gemfile +26 -0
  21. data/gemfiles/rails_5.gemfile +26 -0
  22. data/gemfiles/rails_6.gemfile +26 -0
  23. data/git_models.gemspec +27 -0
  24. data/lib/git_models.rb +6 -0
  25. data/lib/git_models/test_helpers.rb +60 -0
  26. data/lib/git_models/version.rb +5 -0
  27. data/spec/dummy/Rakefile +6 -0
  28. data/spec/dummy/app/assets/config/manifest.js +3 -0
  29. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  30. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  31. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  32. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  33. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  34. data/spec/dummy/app/models/application_record.rb +7 -0
  35. data/spec/dummy/app/models/branch.rb +8 -0
  36. data/spec/dummy/app/models/commit.rb +8 -0
  37. data/spec/dummy/app/models/repository.rb +8 -0
  38. data/spec/dummy/app/models/user.rb +8 -0
  39. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  40. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  41. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  42. data/spec/dummy/bin/bundle +3 -0
  43. data/spec/dummy/bin/rails +4 -0
  44. data/spec/dummy/bin/rake +4 -0
  45. data/spec/dummy/bin/setup +36 -0
  46. data/spec/dummy/bin/spring +16 -0
  47. data/spec/dummy/bin/update +31 -0
  48. data/spec/dummy/bin/yarn +11 -0
  49. data/spec/dummy/config.ru +7 -0
  50. data/spec/dummy/config/application.rb +25 -0
  51. data/spec/dummy/config/boot.rb +5 -0
  52. data/spec/dummy/config/credentials.yml.enc +1 -0
  53. data/spec/dummy/config/database.yml +27 -0
  54. data/spec/dummy/config/environment.rb +8 -0
  55. data/spec/dummy/config/environments/development.rb +63 -0
  56. data/spec/dummy/config/environments/production.rb +96 -0
  57. data/spec/dummy/config/environments/test.rb +55 -0
  58. data/spec/dummy/config/initializers/application_controller_renderer.rb +10 -0
  59. data/spec/dummy/config/initializers/assets.rb +16 -0
  60. data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
  61. data/spec/dummy/config/initializers/content_security_policy.rb +27 -0
  62. data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
  63. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  64. data/spec/dummy/config/initializers/inflections.rb +18 -0
  65. data/spec/dummy/config/initializers/mime_types.rb +6 -0
  66. data/spec/dummy/config/initializers/session_store.rb +5 -0
  67. data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
  68. data/spec/dummy/config/locales/en.yml +33 -0
  69. data/spec/dummy/config/puma.rb +39 -0
  70. data/spec/dummy/config/routes.rb +5 -0
  71. data/spec/dummy/config/spring.rb +8 -0
  72. data/spec/dummy/config/storage.yml +34 -0
  73. data/spec/dummy/db/migrate/20161123065534_create_users_table.rb +16 -0
  74. data/spec/dummy/db/migrate/20161123184217_create_commits_repositories_branches.rb +37 -0
  75. data/spec/dummy/db/schema.rb +53 -0
  76. data/spec/dummy/spec/models/branch_spec.rb +84 -0
  77. data/spec/dummy/spec/models/commit_spec.rb +60 -0
  78. data/spec/dummy/spec/models/user_spec.rb +64 -0
  79. data/spec/dummy/spec/spec_helper.rb +48 -0
  80. metadata +231 -0
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ config.eager_load = false
7
+
8
+ # The test environment is used exclusively to run your application's
9
+ # test suite. You never need to work with it otherwise. Remember that
10
+ # your test database is "scratch space" for the test suite and is wiped
11
+ # and recreated between test runs. Don't rely on the data there!
12
+ config.cache_classes = true
13
+
14
+ # Do not eager load code on boot. This avoids loading your whole application
15
+ # just for the purpose of running a single test. If you are using a tool that
16
+ # preloads Rails for running tests, you may have to set it to true.
17
+ config.eager_load = false
18
+
19
+ # Configure public file server for tests with Cache-Control for performance.
20
+ if Rails::VERSION::MAJOR == 4
21
+ config.serve_static_files = true
22
+ config.static_cache_control = 'public, max-age=3600'
23
+ else
24
+ config.public_file_server.enabled = true
25
+ config.public_file_server.headers = {
26
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
27
+ }
28
+ end
29
+
30
+ # Show full error reports and disable caching.
31
+ config.consider_all_requests_local = true
32
+ config.action_controller.perform_caching = false
33
+
34
+ # Raise exceptions instead of rendering exception templates.
35
+ config.action_dispatch.show_exceptions = false
36
+
37
+ # Disable request forgery protection in test environment.
38
+ config.action_controller.allow_forgery_protection = false
39
+
40
+ # Store uploaded files on the local file system in a temporary directory
41
+ # config.active_storage.service = :test
42
+
43
+ # config.action_mailer.perform_caching = false
44
+
45
+ # Tell Action Mailer not to deliver emails to the real world.
46
+ # The :test delivery method accumulates sent emails in the
47
+ # ActionMailer::Base.deliveries array.
48
+ config.action_mailer.delivery_method = :test
49
+
50
+ # Print deprecation notices to the stderr.
51
+ config.active_support.deprecation = :stderr
52
+
53
+ # Raises error for missing translations
54
+ # config.action_view.raise_on_missing_translations = true
55
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # ActiveSupport::Reloader.to_prepare do
6
+ # ApplicationController.renderer.defaults.merge!(
7
+ # http_host: 'example.org',
8
+ # https: false
9
+ # )
10
+ # end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Version of your assets, change this if you want to expire all your assets.
6
+ Rails.application.config.assets.version = '1.0'
7
+
8
+ # Add additional assets to the asset load path.
9
+ # Rails.application.config.assets.paths << Emoji.images_path
10
+ # Add Yarn node_modules folder to the asset load path.
11
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
12
+
13
+ # Precompile additional assets.
14
+ # application.js, application.css, and all non-JS/CSS in the app/assets
15
+ # folder are already added.
16
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
6
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
7
+
8
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
9
+ Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Define an application-wide content security policy
6
+ # For further information see the following documentation
7
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
8
+
9
+ # Rails.application.config.content_security_policy do |policy|
10
+ # policy.default_src :self, :https
11
+ # policy.font_src :self, :https, :data
12
+ # policy.img_src :self, :https, :data
13
+ # policy.object_src :none
14
+ # policy.script_src :self, :https
15
+ # policy.style_src :self, :https
16
+
17
+ # # Specify URI for violation reports
18
+ # # policy.report_uri "/csp-violation-report-endpoint"
19
+ # end
20
+
21
+ # If you are using UJS then enable automatic nonce generation
22
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
23
+
24
+ # Report CSP violations to a specified URI
25
+ # For further information see the following documentation:
26
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
27
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Specify a serializer for the signed and encrypted cookie jars.
6
+ # Valid options are :json, :marshal, and :hybrid.
7
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Configure sensitive parameters which will be filtered from the log file.
6
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Add new inflection rules using the following format. Inflections
6
+ # are locale specific, and you may define rules for as many different
7
+ # locales as you wish. All of these examples are active by default:
8
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
9
+ # inflect.plural /^(ox)$/i, '\1en'
10
+ # inflect.singular /^(ox)en/i, '\1'
11
+ # inflect.irregular 'person', 'people'
12
+ # inflect.uncountable %w( fish sheep )
13
+ # end
14
+
15
+ # These inflection rules are supported but not enabled by default:
16
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
17
+ # inflect.acronym 'RESTful'
18
+ # end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Add new mime types for use in respond_to blocks:
6
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # This file contains settings for ActionController::ParamsWrapper which
6
+ # is enabled by default.
7
+
8
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9
+ ActiveSupport.on_load(:action_controller) do
10
+ wrap_parameters format: [:json]
11
+ end
12
+
13
+ # To enable root element in JSON for ActiveRecord objects.
14
+ # ActiveSupport.on_load(:active_record) do
15
+ # self.include_root_in_json = true
16
+ # end
@@ -0,0 +1,33 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at http://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+ hello: "Hello world"
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Puma can serve each request in a thread from an internal thread pool.
4
+ # The `threads` method setting takes two numbers: a minimum and maximum.
5
+ # Any libraries that use thread pools should be configured to match
6
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
7
+ # and maximum; this matches the default thread size of Active Record.
8
+ #
9
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
10
+ threads threads_count, threads_count
11
+
12
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
13
+ #
14
+ port ENV.fetch("PORT") { 3000 }
15
+
16
+ # Specifies the `environment` that Puma will run in.
17
+ #
18
+ environment ENV.fetch("RAILS_ENV") { "development" }
19
+
20
+ # Specifies the `pidfile` that Puma will use.
21
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
22
+
23
+ # Specifies the number of `workers` to boot in clustered mode.
24
+ # Workers are forked webserver processes. If using threads and workers together
25
+ # the concurrency of the application would be max `threads` * `workers`.
26
+ # Workers do not work on JRuby or Windows (both of which do not support
27
+ # processes).
28
+ #
29
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
30
+
31
+ # Use the `preload_app!` method when specifying a `workers` number.
32
+ # This directive tells Puma to first boot the application and load code
33
+ # before forking the application. This takes advantage of Copy On Write
34
+ # process behavior so workers use less memory.
35
+ #
36
+ # preload_app!
37
+
38
+ # Allow puma to be restarted by `rails restart` command.
39
+ plugin :tmp_restart
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.routes.draw do
4
+ # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
5
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ %w[
4
+ .ruby-version
5
+ .rbenv-vars
6
+ tmp/restart.txt
7
+ tmp/caching-dev.txt
8
+ ].each { |path| Spring.watch(path) }
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket
23
+
24
+ # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateUsersTable < ActiveRecord::Migration
4
+ def self.up
5
+ create_table :users do |t|
6
+ t.text :name, :limit => 255, :null => false
7
+ t.text :email, :limit => 255, :null => false
8
+ t.datetime :created_at
9
+ t.datetime :updated_at
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :users
15
+ end
16
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateCommitsRepositoriesBranches < ActiveRecord::Migration
4
+ def self.up
5
+ create_table :branches do |t|
6
+ t.datetime :git_updated_at, :null => false
7
+ t.text :name, :limit => 1024, :null => false
8
+ t.datetime :created_at
9
+ t.datetime :updated_at
10
+ t.integer :author_id
11
+ t.integer :repository_id
12
+ end
13
+ add_index :branches, [:author_id]
14
+ add_index :branches, [:repository_id]
15
+
16
+ create_table :commits do |t|
17
+ t.text :sha, :limit => 40, :null => false
18
+ t.text :message, :limit => 1024, :null => false
19
+ t.datetime :created_at
20
+ t.datetime :updated_at
21
+ t.integer :author_id
22
+ end
23
+ add_index :commits, [:author_id]
24
+
25
+ create_table :repositories do |t|
26
+ t.text :name, :limit => 1024, :null => false
27
+ t.datetime :created_at
28
+ t.datetime :updated_at
29
+ end
30
+ end
31
+
32
+ def self.down
33
+ drop_table :branches
34
+ drop_table :commits
35
+ drop_table :repositories
36
+ end
37
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # encoding: UTF-8
4
+ # This file is auto-generated from the current state of the database. Instead
5
+ # of editing this file, please use the migrations feature of Active Record to
6
+ # incrementally modify your database, and then regenerate this schema definition.
7
+ #
8
+ # Note that this schema.rb definition is the authoritative source for your
9
+ # database schema. If you need to create the application database on another
10
+ # system, you should be using db:schema:load, not running all the migrations
11
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
12
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
13
+ #
14
+ # It's strongly recommended that you check this file into your version control system.
15
+
16
+ ActiveRecord::Schema.define(version: 20161123184217) do
17
+
18
+ create_table "branches", force: :cascade do |t|
19
+ t.datetime "git_updated_at", null: false
20
+ t.text "name", limit: 1024, null: false
21
+ t.datetime "created_at"
22
+ t.datetime "updated_at"
23
+ t.integer "author_id"
24
+ t.integer "repository_id"
25
+ end
26
+
27
+ add_index "branches", ["author_id"], name: "index_branches_on_author_id"
28
+ add_index "branches", ["repository_id"], name: "index_branches_on_repository_id"
29
+
30
+ create_table "commits", force: :cascade do |t|
31
+ t.text "sha", limit: 40, null: false
32
+ t.text "message", limit: 1024, null: false
33
+ t.datetime "created_at"
34
+ t.datetime "updated_at"
35
+ t.integer "author_id"
36
+ end
37
+
38
+ add_index "commits", ["author_id"], name: "index_commits_on_author_id"
39
+
40
+ create_table "repositories", force: :cascade do |t|
41
+ t.text "name", limit: 1024, null: false
42
+ t.datetime "created_at"
43
+ t.datetime "updated_at"
44
+ end
45
+
46
+ create_table "users", force: :cascade do |t|
47
+ t.text "name", limit: 255, null: false
48
+ t.text "email", limit: 255, null: false
49
+ t.datetime "created_at"
50
+ t.datetime "updated_at"
51
+ end
52
+
53
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../app/models/branch'
4
+
5
+ RSpec.describe Branch do
6
+ it 'can create be constructed from git data' do
7
+ branch = GitModels::TestHelpers.create_branch
8
+ expect(branch.name).to eq('path/branch')
9
+ expect(branch.git_updated_at).not_to be_nil
10
+ expect(branch.created_at).not_to be_nil
11
+ expect(branch.updated_at).not_to be_nil
12
+ end
13
+
14
+ it 'does not create duplicate database records' do
15
+ expect(Branch.all.count).to eq(0)
16
+ git_data = Git::GitBranch.new('repository_name', 'name', Time.current, 'author_name', 'author@email.com')
17
+ Branch.create_from_git_data!(git_data)
18
+ expect(Branch.all.count).to eq(1)
19
+
20
+ Branch.create_from_git_data!(git_data)
21
+ expect(Branch.all.count).to eq(1)
22
+ end
23
+
24
+ it 'distinguishes between branches in different repositories' do
25
+ git_data_a = Git::GitBranch.new('repository_name', 'name', Time.current, 'author_name', 'author@email.com')
26
+ Branch.create_from_git_data!(git_data_a)
27
+ expect(Branch.all.count).to eq(1)
28
+
29
+ git_data_b = Git::GitBranch.new('other_repository_name', 'name', Time.current, 'author_name', 'author@email.com')
30
+ Branch.create_from_git_data!(git_data_b)
31
+ expect(Branch.all.count).to eq(2)
32
+ end
33
+
34
+ it 'can be sorted alphabetically by name' do
35
+ names = ['b', 'd', 'a', 'c']
36
+ (0..3).each do |i|
37
+ GitModels::TestHelpers.create_branch(name: names[i])
38
+ end
39
+ # ensure they came out of the DB in the same order we put them in
40
+ expect(Branch.first.name).to eq('b')
41
+
42
+ # sort the names and the branches, they should match
43
+ names.sort.zip(Branch.all.sort).each do |name, branch|
44
+ expect(branch.name).to eq(name)
45
+ end
46
+ end
47
+
48
+ context 'with two existing branches' do
49
+ before do
50
+ (0..1).each do |i|
51
+ GitModels::TestHelpers.create_branch(name: "path/branch#{i}")
52
+ end
53
+ end
54
+
55
+ it 'returns branches_not_updated_since' do
56
+ expect(Branch.branches_not_updated_since(10.minutes.from_now).size).to eq(2)
57
+ expect(Branch.branches_not_updated_since(10.minutes.ago).size).to eq(0)
58
+ end
59
+ end
60
+
61
+ it 'returns branches from a repository' do
62
+ GitModels::TestHelpers.create_branch(repository_name: 'repository_a', name: 'name_a')
63
+ GitModels::TestHelpers.create_branch(repository_name: 'repository_b', name: 'name_b')
64
+
65
+ branches_a = Branch.from_repository('repository_a').all
66
+ expect(branches_a.size).to eq(1)
67
+ expect(branches_a[0].name).to eq('name_a')
68
+ end
69
+
70
+ context 'with an existing branch' do
71
+ before do
72
+ @branch = GitModels::TestHelpers.create_branch
73
+ end
74
+
75
+ it 'prints its name when stringified' do
76
+ expect(@branch.to_s).to eq('path/branch')
77
+ end
78
+
79
+ it 'can be compared with a regular expression' do
80
+ expect(@branch =~ /path.*/).to be_truthy
81
+ expect(@branch =~ /notmypath.*/).to be_falsey
82
+ end
83
+ end
84
+ end