capnotify 0.1.2pre → 0.1.3pre
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/lib/capnotify/version.rb +1 -1
- data/lib/capnotify.rb +5 -1
- data/spec/capnotify_spec.rb +23 -2
- metadata +1 -1
data/lib/capnotify/version.rb
CHANGED
data/lib/capnotify.rb
CHANGED
@@ -37,7 +37,11 @@ module Capnotify
|
|
37
37
|
|
38
38
|
# override this to change the default behavior for capnotify.appname
|
39
39
|
_cset(:capnotify_appname) do
|
40
|
-
[ fetch(:application, nil), fetch(:stage, nil) ].compact.join(" ")
|
40
|
+
name = [ fetch(:application, nil), fetch(:stage, nil) ].compact.join(" ")
|
41
|
+
if fetch(:branch, nil)
|
42
|
+
name = "name / #{ branch }"
|
43
|
+
end
|
44
|
+
name
|
41
45
|
end
|
42
46
|
|
43
47
|
# default messages:
|
data/spec/capnotify_spec.rb
CHANGED
@@ -156,11 +156,32 @@ describe Capnotify do
|
|
156
156
|
end
|
157
157
|
|
158
158
|
it "should include the application name" do
|
159
|
-
config.capnotify_appname.should match(
|
159
|
+
config.capnotify_appname.should match(/SimpleApp/)
|
160
160
|
end
|
161
161
|
|
162
162
|
it "should include the stage name" do
|
163
|
-
config.capnotify_appname.should match(
|
163
|
+
config.capnotify_appname.should match(/production/)
|
164
|
+
end
|
165
|
+
|
166
|
+
context "when the branch is not specified" do
|
167
|
+
|
168
|
+
it "should only include the app and stage name" do
|
169
|
+
config.capnotify_appname.split(/\s/).count.should == 2 # should only have 2 words in it
|
170
|
+
config.capnotify_appname.should_not match(/\//) # should not have a slash
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
context "when the branch is specified" do
|
176
|
+
|
177
|
+
before do
|
178
|
+
config.set :branch, 'mybranch'
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should contain the branch name" do
|
182
|
+
config.capnotify_appname.should match(/mybranch/)
|
183
|
+
end
|
184
|
+
|
164
185
|
end
|
165
186
|
|
166
187
|
end
|