spec/generators/question_spec.rb in genspec-0.3.1 vs spec/generators/question_spec.rb in genspec-0.3.2
- old
+ new
@@ -1,8 +1,8 @@
require 'spec_helper'
-describe :question do
+shared_examples_for 'the question generator' do
context "without input" do
it "should raise an error" do
expect(proc { expect(subject).to output("Are you a GOD?")
}).to raise_error
end
@@ -28,6 +28,16 @@
it "should not raise an error" do
expect(proc { expect(subject).to output("You're new around here, aren't you?")
}).not_to raise_error
end
end
+end
+
+# test that we can pass a generator by class, there's no reason this shouldn't
+# be possible
+describe Question do
+ it_should_behave_like 'the question generator'
+end
+
+describe :question do
+ it_should_behave_like 'the question generator'
end