rspec_gem 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -11
- data/bin/rspec_gem +20 -4
- data/lib/rspec_gem/version.rb +1 -1
- data/rspec_gem.gemspec +2 -1
- data/spec/rspec_gem_spec/rspec_gem_spec.gemspec +0 -1
- data/spec/rspec_gem_spec/spec/spec_helper.rb +2 -15
- metadata +18 -2
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
For example, you have rails application of name "rails_app" and gem of name "
|
21
|
+
For example, you have rails application of name "rails_app" and gem of name "example_gem" with the files for testing.
|
22
22
|
|
23
23
|
### 0.2.x
|
24
24
|
|
@@ -35,39 +35,47 @@ which you add into file spec_helper.rb which is included in your gem, for exampl
|
|
35
35
|
require "rspec_gem"
|
36
36
|
RspecGem.require_rails_environment
|
37
37
|
|
38
|
-
Finally in your application rails_app invoke command (all tests from directory "spec" from gem
|
38
|
+
Finally in your application rails_app invoke command (all tests from directory "spec" from gem example_gem)
|
39
39
|
|
40
|
-
$ rspec_gem
|
40
|
+
$ bundle exec rspec_gem example_gem spec
|
41
41
|
|
42
42
|
with color
|
43
43
|
|
44
|
-
$ bundle exec rspec_gem
|
44
|
+
$ bundle exec rspec_gem example_gem spec --color
|
45
45
|
|
46
46
|
more precisely
|
47
47
|
|
48
|
-
$ rspec_gem
|
48
|
+
$ rspec_gem example_gem spec/example_gem_spec.rb
|
49
|
+
|
50
|
+
show all tracks to testing files
|
51
|
+
|
52
|
+
$ rspec_gem example_gem -t
|
53
|
+
|
54
|
+
run the spork
|
55
|
+
|
56
|
+
$ rspec_gem example_gem spork
|
49
57
|
|
50
58
|
### 0.1.x
|
51
59
|
|
52
60
|
Then you should include
|
53
61
|
|
54
62
|
require "rspec_gem"
|
55
|
-
RspecGem.new(File.expand_path("../..", __FILE__), "
|
63
|
+
RspecGem.new(File.expand_path("../..", __FILE__), "example_gem")
|
56
64
|
|
57
|
-
into file ../
|
65
|
+
into file ../example_gem/lib/example_gem.rb in your gem.
|
58
66
|
|
59
67
|
You can use path into rails environment by use method (Usage resource of application, like models)
|
60
68
|
|
61
69
|
RspecGem.path_rails_environment
|
62
70
|
|
63
|
-
Finally in your application rails_app invoke command (all tests from directory "spec" from gem
|
71
|
+
Finally in your application rails_app invoke command (all tests from directory "spec" from gem example_gem)
|
64
72
|
|
65
|
-
$ RAILS_ENV=test rake
|
73
|
+
$ RAILS_ENV=test rake example_gem:rspec spec
|
66
74
|
|
67
75
|
with color
|
68
76
|
|
69
|
-
$ RAILS_ENV=test rake
|
77
|
+
$ RAILS_ENV=test rake example_gem:rspec "spec --color"
|
70
78
|
|
71
79
|
more precisely
|
72
80
|
|
73
|
-
$ RAILS_ENV=test rake
|
81
|
+
$ RAILS_ENV=test rake example_gem:rspec spec/example_gem_spec.rb
|
data/bin/rspec_gem
CHANGED
@@ -1,8 +1,24 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require "logger"
|
4
|
+
|
3
5
|
rails_root = ENV["PWD"]
|
4
|
-
|
6
|
+
name_of_gem = ARGV[0]
|
5
7
|
gem_root = Gem::Specification.find_by_name(ARGV[0]).gem_dir
|
6
|
-
|
7
|
-
|
8
|
-
|
8
|
+
|
9
|
+
case ARGV[1].to_s
|
10
|
+
when "spork"
|
11
|
+
all_arg = ARGV.join(" ")
|
12
|
+
command = "cd #{gem_root} && #{all_arg}"
|
13
|
+
puts command
|
14
|
+
system(command)
|
15
|
+
else
|
16
|
+
if ARGV[1] == "-t"
|
17
|
+
puts Dir["#{gem_root}/**/*_spec.rb"]
|
18
|
+
else
|
19
|
+
rest_arg = ARGV[1...ARGV.length].join(" ")
|
20
|
+
command = "rspec #{File.join(gem_root, rest_arg)}"
|
21
|
+
puts command
|
22
|
+
system(command)
|
23
|
+
end
|
24
|
+
end
|
data/lib/rspec_gem/version.rb
CHANGED
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-10-
|
10
|
+
gem.date = "2012-10-10"
|
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.}
|
@@ -23,4 +23,5 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_dependency "rake"
|
24
24
|
gem.add_dependency "logger", ">= 1.2.8"
|
25
25
|
gem.add_dependency "database_cleaner"
|
26
|
+
gem.add_dependency "spork", ">= 0.9.2"
|
26
27
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
require "rspec_gem"
|
2
3
|
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
|
4
|
+
RspecGem.require_rails_environment
|
4
5
|
require 'rspec/rails'
|
5
6
|
require 'rspec/autorun'
|
6
7
|
|
@@ -9,14 +10,6 @@ require 'rspec/autorun'
|
|
9
10
|
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
10
11
|
|
11
12
|
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
13
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
21
14
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
15
|
|
@@ -29,10 +22,4 @@ RSpec.configure do |config|
|
|
29
22
|
# automatically. This will be the default behavior in future versions of
|
30
23
|
# rspec-rails.
|
31
24
|
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
25
|
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.2.
|
4
|
+
version: 0.2.4
|
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-10-
|
12
|
+
date: 2012-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -75,6 +75,22 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: spork
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.9.2
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.9.2
|
78
94
|
description: Invoke the tests rspec from gems in application rails.
|
79
95
|
email:
|
80
96
|
- raglub.ruby@gmail.com
|