Skip to content

Commit

Permalink
Clean up test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Nov 13, 2020
1 parent 2c4772c commit d1af26e
Show file tree
Hide file tree
Showing 89 changed files with 1,245 additions and 505 deletions.
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
.bundle
Gemfile.lock
pkg/*
spec/*.sqlite3
spec/*.log
spec/dummy/db/*.sqlite3
spec/dummy/db/*.sqlite3-journal
spec/dummy/db/*.sqlite3-*
spec/dummy/log/*.log
spec/dummy/storage/
spec/dummy/tmp/
.byebug_history
.DS_Store
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Unreleased
----------

* Refactor test suite and use dummy Rails app - @excid3
* Remove tenant getter override. Fixes caching issues with association. - @bernardeli

0.4.6
Expand Down
15 changes: 13 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
source "http://rubygems.org"
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

# Specify your gem's dependencies in acts_as_tenant.gemspec
# Declare your gem's dependencies in noticed.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

# To use a debugger
gem "byebug", group: [:development, :test]
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
require "bundler/gem_tasks"

APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
load "rails/tasks/engine.rake"
load "rails/tasks/statistics.rake"

require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task default: :spec
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

1 change: 0 additions & 1 deletion acts_as_tenant.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Gem::Specification.new do |s|

s.add_development_dependency "rspec", ">=3.0"
s.add_development_dependency "rspec-rails"
s.add_development_dependency "database_cleaner", "~> 1.8"
s.add_development_dependency "sqlite3"
s.add_development_dependency "sidekiq", "~> 6.1", ">= 6.1.2"
s.add_development_dependency "standard"
Expand Down
13 changes: 13 additions & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.

ENGINE_ROOT = File.expand_path('..', __dir__)
APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)

# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

require 'rails/all'
require 'rails/engine/commands'
5 changes: 5 additions & 0 deletions bin/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env ruby
$: << File.expand_path("../test", __dir__)

require "bundler/setup"
require "rails/plugin/test"
2 changes: 0 additions & 2 deletions rails/init.rb

This file was deleted.

21 changes: 0 additions & 21 deletions spec/active_record_helper.rb

This file was deleted.

151 changes: 0 additions & 151 deletions spec/active_record_models.rb

This file was deleted.

24 changes: 7 additions & 17 deletions spec/acts_as_tenant/configuration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
require "spec_helper"

describe ActsAsTenant::Configuration do
describe "no configuration given" do
before do
ActsAsTenant.configure
end
after { ActsAsTenant.configure }

it "provides defaults" do
expect(ActsAsTenant.configuration.require_tenant).not_to be_truthy
end
it "provides defaults" do
expect(ActsAsTenant.configuration.require_tenant).not_to be_truthy
end

describe "with config block" do
after do
ActsAsTenant.configure
it "stores config" do
ActsAsTenant.configure do |config|
config.require_tenant = true
end

it "stores config" do
ActsAsTenant.configure do |config|
config.require_tenant = true
end

expect(ActsAsTenant.configuration.require_tenant).to eq(true)
end
expect(ActsAsTenant.configuration.require_tenant).to eq(true)
end
end
Loading

0 comments on commit d1af26e

Please sign in to comment.