genspec 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/genspec/matchers/base.rb +3 -3
- data/lib/genspec/version.rb +1 -1
- data/spec/generators/question_spec.rb +11 -1
- data/spec/spec_helper.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90d6e7ee1337b4a3c20038fd3527f7e9a51bb8f8
|
4
|
+
data.tar.gz: e3743f3e0ddf711cdafb637c8debab9338d91f48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce6b36e9478a07476358f97d190eb56c3a24b042ff21064c6faba939866bcc6329c3cde4269c85a9c8c87144e724d6a7bedebc4dfcf2548fc074e721bc683228
|
7
|
+
data.tar.gz: 4068692392fe63cc4e49c73f4f4b6a9ea55d1171d06947b9458c21391f250ce60c3c1f3b2029b2b77ef890b73aa7650939eaad6509973cf6295b779cda62daaf
|
@@ -19,7 +19,7 @@ module GenSpec
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def matches?(generator)
|
22
|
-
@described = generator[:described]
|
22
|
+
@described = generator[:described]
|
23
23
|
base = nil
|
24
24
|
base, @described = @described.split(/:/) if @described =~ /:/
|
25
25
|
@args = generator[:args]
|
@@ -31,9 +31,9 @@ module GenSpec
|
|
31
31
|
@generator = @described
|
32
32
|
else
|
33
33
|
if GenSpec.rails?
|
34
|
-
@generator = Rails::Generators.find_by_namespace(@described, base)
|
34
|
+
@generator = Rails::Generators.find_by_namespace(@described.to_s, base)
|
35
35
|
else
|
36
|
-
@generator = Thor::Util.find_by_namespace(@described)
|
36
|
+
@generator = Thor::Util.find_by_namespace(@described.to_s)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
data/lib/genspec/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
shared_examples_for 'the question generator' do
|
4
4
|
context "without input" do
|
5
5
|
it "should raise an error" do
|
6
6
|
expect(proc { expect(subject).to output("Are you a GOD?")
|
@@ -31,3 +31,13 @@ describe :question do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
# test that we can pass a generator by class, there's no reason this shouldn't
|
36
|
+
# be possible
|
37
|
+
describe Question do
|
38
|
+
it_should_behave_like 'the question generator'
|
39
|
+
end
|
40
|
+
|
41
|
+
describe :question do
|
42
|
+
it_should_behave_like 'the question generator'
|
43
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -27,10 +27,14 @@ module CustomActions
|
|
27
27
|
end
|
28
28
|
|
29
29
|
require 'genspec'
|
30
|
+
# always load this one, because we'll reference it by class name in specs,
|
31
|
+
# so it has to be defined before they load.
|
32
|
+
require File.expand_path('support/generators/question/question_generator', File.dirname(__FILE__))
|
30
33
|
unless GenSpec.rails?
|
34
|
+
# only load this one when rails isn't around, because rails should autoload
|
35
|
+
# it if rails is in use
|
31
36
|
require 'thor/group'
|
32
37
|
require File.expand_path('support/generators/test_rails3/test_rails3_generator', File.dirname(__FILE__))
|
33
|
-
require File.expand_path('support/generators/question/question_generator', File.dirname(__FILE__))
|
34
38
|
end
|
35
39
|
|
36
40
|
if RSpec::Expectations.respond_to?(:configuration)
|