rearview 1.0.3.rc.1-jruby → 1.0.3.rc.2-jruby

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,20 +6,13 @@ describe Rearview::Alerts::CampfireAlert do
6
6
 
7
7
  context "alert" do
8
8
  context "valid key" do
9
- let(:job) { stub(alert_keys: ["alert_key"], app_id: 1, id: 42) }
10
- let(:params) { { "room" => "nyan" } }
11
-
12
- before(:each ) do
13
- Rearview::Alerts::CampfireAlert.expects(:params).with("alert_key").returns(params)
14
- Rearview::Alerts::CampfireAlert.expects(:key?).returns(true)
15
- Broach.expects(:settings=).with(params)
16
- end
9
+ let(:job) { FactoryGirl.create(:job, alert_keys: ["campfire://mycompany.com?token=abc&room=myroom"]) }
17
10
 
18
11
  context "with provided error message" do
19
12
  let(:result) { { message: "alert alert!"} }
20
13
 
21
14
  it "notifies campfire" do
22
- Broach.expects(:speak).with("nyan", "alert alert! #{Rearview::UrlHelper.job_url(job)}")
15
+ Broach.expects(:speak).with("myroom", "alert alert! #{Rearview::UrlHelper.job_url(job)}")
23
16
  campfire_alert.alert(job, result)
24
17
  end
25
18
  end
@@ -28,7 +21,7 @@ describe Rearview::Alerts::CampfireAlert do
28
21
  let(:result) { { } }
29
22
 
30
23
  it "notifies campfire" do
31
- Broach.expects(:speak).with("nyan", "Job did not provide an error description #{Rearview::UrlHelper.job_url(job)}")
24
+ Broach.expects(:speak).with("myroom", "Job did not provide an error description #{Rearview::UrlHelper.job_url(job)}")
32
25
  campfire_alert.alert(job, result)
33
26
  end
34
27
  end
@@ -1,11 +1,32 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Rearview::UrlHelper do
4
- let(:job) { stub(app_id: 1234, id: 42) }
5
4
  subject { Rearview::UrlHelper }
6
- context ".rearview_uri" do
7
- it "returns rearview uri" do
8
- subject.job_url(job).should eq("http://#{Rearview.config.default_url_options[:host]}:#{Rearview.config.default_url_options[:port]}/rearview/#dash/1234/expand/42")
5
+ context ".job_url" do
6
+ context "job in dashboard with parent" do
7
+ it "generates the correct url" do
8
+ dashboard_child = FactoryGirl.create(:dashboard,parent: FactoryGirl.create(:dashboard))
9
+ job = FactoryGirl.create(:job,app_id: dashboard_child.id)
10
+ expected_url = "http://%s:%s/rearview/#dash/%s/expand/%s" % [
11
+ Rearview.config.default_url_options[:host],
12
+ Rearview.config.default_url_options[:port],
13
+ dashboard_child.parent_id,
14
+ job.id
15
+ ]
16
+ expect(subject.job_url(job)).to eq(expected_url)
17
+ end
18
+ end
19
+ context "job in dashboard without parent" do
20
+ it "generates the correct url" do
21
+ job = FactoryGirl.create(:job)
22
+ expected_url = "http://%s:%s/rearview/#dash/%s/expand/%s" % [
23
+ Rearview.config.default_url_options[:host],
24
+ Rearview.config.default_url_options[:port],
25
+ job.app_id,
26
+ job.id
27
+ ]
28
+ expect(subject.job_url(job)).to eq(expected_url)
29
+ end
9
30
  end
10
31
  end
11
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rearview
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3.rc.1
4
+ version: 1.0.3.rc.2
5
5
  platform: jruby
6
6
  authors:
7
7
  - Trent Albright
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-09 00:00:00.000000000 Z
11
+ date: 2014-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails