rspec_gem 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +24 -3
- data/lib/rspec_gem/version.rb +1 -1
- data/lib/rspec_gem.rb +6 -2
- data/lib/tasks/rspec_gem.rake +7 -6
- data/rspec_gem.gemspec +1 -2
- data/spec/rails_app/Gemfile +2 -1
- data/spec/rails_app/app/models/rspec_gem_model.rb +2 -0
- data/spec/rails_app/db/development.sqlite3 +0 -0
- data/spec/rails_app/db/migrate/20120922085657_create_rspec_gem_models.rb +9 -0
- data/spec/rails_app/db/schema.rb +22 -0
- data/spec/rails_app/db/test.sqlite3 +0 -0
- data/spec/rails_app/log/test.log +12 -0
- data/spec/rails_app/spec/spec_helper.rb +38 -0
- data/spec/rspec_gem_spec/lib/rspec_gem_spec.rb +2 -1
- data/spec/rspec_gem_spec/rspec_gem_spec.gemspec +2 -0
- data/spec/rspec_gem_spec/spec/models/rspec_gem_model_spec.rb +8 -0
- data/spec/rspec_gem_spec/spec/spec_helper.rb +38 -0
- data/spec/rspec_gem_spec.rb +3 -6
- metadata +20 -22
- data/spec/rails_app/app/mailers/.gitkeep +0 -0
- data/spec/rspec_gem_spec/spec/rspec_gem_spec_spec.rb +0 -1
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RspecGem
|
2
2
|
|
3
|
-
Invoke the tests rspec from gems in application rails.
|
3
|
+
Invoke the tests rspec from gems in application rails.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,6 +18,27 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
For example, you have rails application of name "rails_app" and gem of name "testing_gem" with the files for testing.
|
22
22
|
|
23
|
-
|
23
|
+
Then you should include
|
24
|
+
|
25
|
+
require "rspec_gem"
|
26
|
+
RspecGem.new(File.expand_path("../..", __FILE__), "testing_gem")
|
27
|
+
|
28
|
+
into file ../testing_gem/lib/testing_gem.rb in your gem.
|
29
|
+
|
30
|
+
You can use path into rails environment through use method (Usage resource of application, like models)
|
31
|
+
|
32
|
+
RspecGem.path_rails_environment
|
33
|
+
|
34
|
+
Finally in your application rails_app invoke command (all tests from directory "spec" from gem testing_gem)
|
35
|
+
|
36
|
+
rake testing_gem:rspec spec
|
37
|
+
|
38
|
+
with color
|
39
|
+
|
40
|
+
rake testing_gem:rspec "spec --color"
|
41
|
+
|
42
|
+
more precision
|
43
|
+
|
44
|
+
rake testing_gem:rspec spec/testing_gem_spec.rb
|
data/lib/rspec_gem/version.rb
CHANGED
data/lib/rspec_gem.rb
CHANGED
@@ -3,9 +3,12 @@ require_relative "rspec_gem/version"
|
|
3
3
|
|
4
4
|
class RspecGem
|
5
5
|
|
6
|
-
|
6
|
+
# create task for your gem
|
7
|
+
# path - path into directory of your gem
|
8
|
+
# name_of_gem - name of your gem
|
9
|
+
def initialize(path, name_of_gem)
|
7
10
|
@@path = path
|
8
|
-
@@name_of_gem =
|
11
|
+
@@name_of_gem = name_of_gem
|
9
12
|
load File.expand_path("../tasks/rspec_gem.rake", __FILE__) if defined?(Rake)
|
10
13
|
end
|
11
14
|
|
@@ -19,6 +22,7 @@ class RspecGem
|
|
19
22
|
end
|
20
23
|
|
21
24
|
def path_rails_environment
|
25
|
+
return File.expand_path("config/environment", Rails.root) if defined?(Rails)
|
22
26
|
File.expand_path("config/environment", ENV["PWD"])
|
23
27
|
end
|
24
28
|
end
|
data/lib/tasks/rspec_gem.rake
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
2
|
require "logger"
|
4
|
-
|
5
3
|
namespace RspecGem.name_of_gem do
|
6
|
-
desc "testing gem #{RspecGem.name_of_gem}"
|
7
|
-
task :rspec
|
8
|
-
|
9
|
-
|
4
|
+
desc "testing gem #{RspecGem.name_of_gem.clone}"
|
5
|
+
task :rspec do
|
6
|
+
arg = ARGV.last
|
7
|
+
task arg.to_sym do ; end
|
8
|
+
command = "rspec #{File.expand_path(arg, RspecGem.path)}".clone
|
9
|
+
Logger.new(STDOUT).info command
|
10
|
+
system(command)
|
10
11
|
end
|
11
12
|
end
|
data/rspec_gem.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.name = "rspec_gem"
|
8
8
|
gem.version = RspecGem::VERSION
|
9
9
|
gem.platform = Gem::Platform::RUBY
|
10
|
-
gem.date = "2012-09-
|
10
|
+
gem.date = "2012-09-22"
|
11
11
|
gem.authors = ["michal szyma"]
|
12
12
|
gem.email = ["raglub.ruby@gmail.com"]
|
13
13
|
gem.description = %q{Invoke the tests rspec from gems in application rails.}
|
@@ -19,6 +19,5 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
21
|
gem.add_dependency "rspec"
|
22
|
-
gem.add_dependency "logger", ">= 1.2.8"
|
23
22
|
gem.add_dependency "rake"
|
24
23
|
end
|
data/spec/rails_app/Gemfile
CHANGED
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 20120922085657) do
|
15
|
+
|
16
|
+
create_table "rspec_gem_models", :force => true do |t|
|
17
|
+
t.string "name"
|
18
|
+
t.datetime "created_at", :null => false
|
19
|
+
t.datetime "updated_at", :null => false
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
Binary file
|
@@ -0,0 +1,12 @@
|
|
1
|
+
[1m[36m (0.8ms)[0m [1mbegin transaction[0m
|
2
|
+
[1m[35m (0.2ms)[0m SAVEPOINT active_record_1
|
3
|
+
[1m[36mSQL (13.1ms)[0m [1mINSERT INTO "rspec_gem_models" ("created_at", "name", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Sat, 22 Sep 2012 09:17:48 UTC +00:00], ["name", "example"], ["updated_at", Sat, 22 Sep 2012 09:17:48 UTC +00:00]]
|
4
|
+
[1m[35m (0.2ms)[0m RELEASE SAVEPOINT active_record_1
|
5
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM "rspec_gem_models" [0m
|
6
|
+
[1m[35m (0.3ms)[0m rollback transaction
|
7
|
+
[1m[36m (0.8ms)[0m [1mbegin transaction[0m
|
8
|
+
[1m[35m (0.2ms)[0m SAVEPOINT active_record_1
|
9
|
+
[1m[36mSQL (57.5ms)[0m [1mINSERT INTO "rspec_gem_models" ("created_at", "name", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Sat, 22 Sep 2012 09:46:02 UTC +00:00], ["name", "example"], ["updated_at", Sat, 22 Sep 2012 09:46:02 UTC +00:00]]
|
10
|
+
[1m[35m (0.2ms)[0m RELEASE SAVEPOINT active_record_1
|
11
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM "rspec_gem_models" [0m
|
12
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
|
7
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
+
# in spec/support/ and its subdirectories.
|
9
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# ## Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
# config.mock_with :rr
|
19
|
+
|
20
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
+
# examples within a transaction, remove the following line or assign false
|
25
|
+
# instead of true.
|
26
|
+
config.use_transactional_fixtures = true
|
27
|
+
|
28
|
+
# If true, the base class of anonymous controllers will be inferred
|
29
|
+
# automatically. This will be the default behavior in future versions of
|
30
|
+
# rspec-rails.
|
31
|
+
config.infer_base_class_for_anonymous_controllers = false
|
32
|
+
|
33
|
+
# Run specs in random order to surface order dependencies. If you find an
|
34
|
+
# order dependency and want to debug it, you can fix the order by providing
|
35
|
+
# the seed, which is printed after each run.
|
36
|
+
# --seed 1234
|
37
|
+
config.order = "random"
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
require RspecGem.path_rails_environment
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
|
7
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
|
+
# in spec/support/ and its subdirectories.
|
9
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# ## Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
# config.mock_with :rr
|
19
|
+
|
20
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
+
# examples within a transaction, remove the following line or assign false
|
25
|
+
# instead of true.
|
26
|
+
config.use_transactional_fixtures = true
|
27
|
+
|
28
|
+
# If true, the base class of anonymous controllers will be inferred
|
29
|
+
# automatically. This will be the default behavior in future versions of
|
30
|
+
# rspec-rails.
|
31
|
+
config.infer_base_class_for_anonymous_controllers = false
|
32
|
+
|
33
|
+
# Run specs in random order to surface order dependencies. If you find an
|
34
|
+
# order dependency and want to debug it, you can fix the order by providing
|
35
|
+
# the seed, which is printed after each run.
|
36
|
+
# --seed 1234
|
37
|
+
config.order = "random"
|
38
|
+
end
|
data/spec/rspec_gem_spec.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
2
|
+
# go into directory rails_app
|
3
|
+
# invoke bundle
|
4
|
+
# finally invoke command "rake rspec_gem_spec:rspec spec"
|
3
5
|
require 'rspec_gem'
|
4
6
|
|
5
7
|
RSpec.configuration.color = true
|
6
8
|
|
7
|
-
describe RspecGem do
|
8
|
-
it "rspec_gem" do
|
9
|
-
puts "rspec_gem"
|
10
|
-
end
|
11
|
-
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: logger
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 1.2.8
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.2.8
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: rake
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,8 +66,8 @@ files:
|
|
82
66
|
- spec/rails_app/app/assets/stylesheets/application.css
|
83
67
|
- spec/rails_app/app/controllers/application_controller.rb
|
84
68
|
- spec/rails_app/app/helpers/application_helper.rb
|
85
|
-
- spec/rails_app/app/mailers/.gitkeep
|
86
69
|
- spec/rails_app/app/models/.gitkeep
|
70
|
+
- spec/rails_app/app/models/rspec_gem_model.rb
|
87
71
|
- spec/rails_app/app/views/layouts/application.html.erb
|
88
72
|
- spec/rails_app/config.ru
|
89
73
|
- spec/rails_app/config/application.rb
|
@@ -101,14 +85,21 @@ files:
|
|
101
85
|
- spec/rails_app/config/initializers/wrap_parameters.rb
|
102
86
|
- spec/rails_app/config/locales/en.yml
|
103
87
|
- spec/rails_app/config/routes.rb
|
88
|
+
- spec/rails_app/db/development.sqlite3
|
89
|
+
- spec/rails_app/db/migrate/20120922085657_create_rspec_gem_models.rb
|
90
|
+
- spec/rails_app/db/schema.rb
|
104
91
|
- spec/rails_app/db/seeds.rb
|
92
|
+
- spec/rails_app/db/test.sqlite3
|
93
|
+
- spec/rails_app/log/test.log
|
94
|
+
- spec/rails_app/spec/spec_helper.rb
|
105
95
|
- spec/rspec_gem_spec.rb
|
106
96
|
- spec/rspec_gem_spec/Gemfile
|
107
97
|
- spec/rspec_gem_spec/Rakefile
|
108
98
|
- spec/rspec_gem_spec/lib/rspec_gem_spec.rb
|
109
99
|
- spec/rspec_gem_spec/lib/rspec_gem_spec/version.rb
|
110
100
|
- spec/rspec_gem_spec/rspec_gem_spec.gemspec
|
111
|
-
- spec/rspec_gem_spec/spec/
|
101
|
+
- spec/rspec_gem_spec/spec/models/rspec_gem_model_spec.rb
|
102
|
+
- spec/rspec_gem_spec/spec/spec_helper.rb
|
112
103
|
homepage: https://github.com/raglub/rspec_gem
|
113
104
|
licenses: []
|
114
105
|
post_install_message:
|
@@ -141,8 +132,8 @@ test_files:
|
|
141
132
|
- spec/rails_app/app/assets/stylesheets/application.css
|
142
133
|
- spec/rails_app/app/controllers/application_controller.rb
|
143
134
|
- spec/rails_app/app/helpers/application_helper.rb
|
144
|
-
- spec/rails_app/app/mailers/.gitkeep
|
145
135
|
- spec/rails_app/app/models/.gitkeep
|
136
|
+
- spec/rails_app/app/models/rspec_gem_model.rb
|
146
137
|
- spec/rails_app/app/views/layouts/application.html.erb
|
147
138
|
- spec/rails_app/config.ru
|
148
139
|
- spec/rails_app/config/application.rb
|
@@ -160,11 +151,18 @@ test_files:
|
|
160
151
|
- spec/rails_app/config/initializers/wrap_parameters.rb
|
161
152
|
- spec/rails_app/config/locales/en.yml
|
162
153
|
- spec/rails_app/config/routes.rb
|
154
|
+
- spec/rails_app/db/development.sqlite3
|
155
|
+
- spec/rails_app/db/migrate/20120922085657_create_rspec_gem_models.rb
|
156
|
+
- spec/rails_app/db/schema.rb
|
163
157
|
- spec/rails_app/db/seeds.rb
|
158
|
+
- spec/rails_app/db/test.sqlite3
|
159
|
+
- spec/rails_app/log/test.log
|
160
|
+
- spec/rails_app/spec/spec_helper.rb
|
164
161
|
- spec/rspec_gem_spec.rb
|
165
162
|
- spec/rspec_gem_spec/Gemfile
|
166
163
|
- spec/rspec_gem_spec/Rakefile
|
167
164
|
- spec/rspec_gem_spec/lib/rspec_gem_spec.rb
|
168
165
|
- spec/rspec_gem_spec/lib/rspec_gem_spec/version.rb
|
169
166
|
- spec/rspec_gem_spec/rspec_gem_spec.gemspec
|
170
|
-
- spec/rspec_gem_spec/spec/
|
167
|
+
- spec/rspec_gem_spec/spec/models/rspec_gem_model_spec.rb
|
168
|
+
- spec/rspec_gem_spec/spec/spec_helper.rb
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
|