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.
@@ -1,3 +1,3 @@
1
1
  module Capnotify
2
- VERSION = "0.1.2pre"
2
+ VERSION = "0.1.3pre"
3
3
  end
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:
@@ -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('SimpleApp')
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('production')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capnotify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2pre
4
+ version: 0.1.3pre
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors: