spicycode-micronaut 0.2.0.0 → 0.2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/examples/example_helper.rb +5 -1
- data/examples/lib/micronaut/configuration_example.rb +16 -0
- data/lib/micronaut/configuration.rb +1 -0
- metadata +1 -1
data/Rakefile
CHANGED
data/examples/example_helper.rb
CHANGED
@@ -33,8 +33,12 @@ def not_in_editor?
|
|
33
33
|
['TM_MODE', 'EMACS', 'VIM'].all? { |k| !ENV.has_key?(k) }
|
34
34
|
end
|
35
35
|
|
36
|
+
def runcoderun?
|
37
|
+
ENV["RUN_CODE_RUN"]
|
38
|
+
end
|
39
|
+
|
36
40
|
Micronaut.configure do |c|
|
37
|
-
|
41
|
+
c.formatter = :documentation if runcoderun?
|
38
42
|
c.mock_with :mocha
|
39
43
|
c.color_enabled = not_in_editor?
|
40
44
|
c.filter_run :focused => true
|
@@ -105,5 +105,21 @@ describe Micronaut::Configuration do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
end
|
108
|
+
|
109
|
+
describe '#formatter' do
|
110
|
+
|
111
|
+
it "sets formatter_to_use based on name" do
|
112
|
+
config = Micronaut::Configuration.new
|
113
|
+
config.formatter = :documentation
|
114
|
+
config.instance_eval { @formatter_to_use.should == Micronaut::Formatters::DocumentationFormatter }
|
115
|
+
config.formatter = 'documentation'
|
116
|
+
config.instance_eval { @formatter_to_use.should == Micronaut::Formatters::DocumentationFormatter }
|
117
|
+
end
|
118
|
+
|
119
|
+
it "raises ArgumentError if formatter is unknown" do
|
120
|
+
config = Micronaut::Configuration.new
|
121
|
+
lambda { config.formatter = :progresss }.should raise_error(ArgumentError)
|
122
|
+
end
|
123
|
+
end
|
108
124
|
|
109
125
|
end
|
@@ -88,6 +88,7 @@ module Micronaut
|
|
88
88
|
@formatter_to_use = case formatter_to_use.to_s
|
89
89
|
when 'documentation' then Micronaut::Formatters::DocumentationFormatter
|
90
90
|
when 'progress' then Micronaut::Formatters::ProgressFormatter
|
91
|
+
else raise(ArgumentError, "Formatter '#{formatter_to_use}' unknown - maybe you meant 'documentation' or 'progress'?.")
|
91
92
|
end
|
92
93
|
end
|
93
94
|
|