Skip to content

Commit d449bc8

Browse files
committed
Setup rspec for the test_app
1 parent ab31c23 commit d449bc8

File tree

9 files changed

+62
-59
lines changed

9 files changed

+62
-59
lines changed

.rspec

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--format progress

Gemfile

+20-8
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@ source 'https://rubygems.org'
55
# development dependencies will be added by default to the :development group.
66
gemspec
77

8-
# jquery-rails is used by the dummy application
9-
gem 'jquery-rails'
108

11-
# Declare any dependencies that are still in development here instead of in
12-
# your gemspec. These might include edge Rails or gems from your path or
13-
# Git. Remember to move these dependencies to your gemspec before releasing
14-
# your gem to rubygems.org.
9+
# Test app stuff
10+
11+
gem 'rails', '~> 3.2.6'
12+
13+
# Gems used only for assets and not required
14+
# in production environments by default.
15+
group :assets do
16+
gem 'sass-rails', '~> 3.2.3'
17+
gem 'coffee-rails', '~> 3.2.1'
18+
19+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
20+
# gem 'therubyracer', :platforms => :ruby
21+
gem 'uglifier', '>= 1.0.3'
22+
end
23+
24+
gem 'jquery-rails'
1525

16-
# To use debugger
17-
# gem 'debugger'
26+
group :test do
27+
gem 'capybara'
28+
gem 'launchy'
29+
end

activeadmin-mongoid.gemspec

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ Gem::Specification.new do |gem|
1515
gem.require_paths = ['lib']
1616
gem.version = ActiveAdmin::Mongoid::VERSION
1717
gem.license = 'MIT'
18-
18+
1919
gem.add_runtime_dependency 'mongoid', '>= 2.0'
20-
gem.add_runtime_dependency 'activeadmin', '~> 0.4'
20+
gem.add_runtime_dependency 'activeadmin', '~> 0.5'
2121
gem.add_runtime_dependency 'meta_search', '>= 1.1.0.pre'
2222
gem.add_runtime_dependency 'sass-rails', ['~> 3.1', '>= 3.1.4']
23+
24+
gem.add_development_dependency 'rspec-rails', '~> 2.7'
2325
end

lib/active_admin/mongoid.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
require 'active_admin/mongoid/version'
2+
# require 'active_admin/mongoid/engine'
13
require 'active_admin'
24

35
module ActiveAdmin
46
module Mongoid
57
end
6-
8+
79
class << self
810
alias setup_without_mongoid setup
9-
11+
1012
# Load monkey patches *after* the setup process
1113
def setup *args, &block
1214
setup_without_mongoid *args, &block
13-
15+
1416
require 'active_admin/mongoid/comments'
1517
require 'active_admin/mongoid/resource'
1618
require 'active_admin/mongoid/document'

lib/active_admin/mongoid/engine.rb

-6
This file was deleted.

lib/activeadmin-mongoid.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
require 'activeadmin/mongoid/version'
2-
require 'activeadmin/mongoid/engine'
1+
require 'active_admin/mongoid'

spec/spec_helper.rb

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
$:.unshift File.expand_path('../../lib', __FILE__)
2+
require 'activeadmin-mongoid'
3+
4+
5+
# Configure Rails Environment
6+
ENV['RAILS_ENV'] = 'test'
7+
8+
require File.expand_path('../../test_app/config/environment.rb', __FILE__)
9+
require 'rspec/rails'
10+
require 'capybara/rspec'
11+
12+
Rails.backtrace_cleaner.remove_silencers!
13+
14+
15+
# Requires supporting ruby files with custom matchers and macros, etc,
16+
# in spec/support/ and its subdirectories.
17+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
18+
19+
RSpec.configure do |config|
20+
config.treat_symbols_as_metadata_keys_with_true_values = true
21+
config.run_all_when_everything_filtered = true
22+
config.filter_run :focus
23+
24+
# Run specs in random order to surface order dependencies. If you find an
25+
# order dependency and want to debug it, you can fix the order by providing
26+
# the seed, which is printed after each run.
27+
# --seed 1234
28+
config.order = 'random'
29+
end

test_app/Gemfile

-37
This file was deleted.

test_app/config/boot.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'rubygems'
22

33
# Set up gems listed in the Gemfile.
4-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
4+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __FILE__)
55

66
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])

0 commit comments

Comments
 (0)