Skip to content

Commit

Permalink
Add view tests for the trial banner
Browse files Browse the repository at this point in the history
  • Loading branch information
henare committed Aug 13, 2015
1 parent 173681b commit d61cc34
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions spec/views/alert_notifier/alert_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
require 'spec_helper'

describe "alert_notifier/alert" do
it "should not use html entities to encode the description" do
assign(:alert, mock_model(Alert, :address => "Foo Parade",
:radius_meters => 2000, :confirm_id => "1234", :subscription => nil))
before(:each) do
application = mock_model(Application, :address => "Bar Street",
:description => "Alterations & additions", :council_reference => "007",
:location => double("Location", :lat => 1.0, :lng => 2.0))
assign(:applications, [application])
assign(:comments, [])
assign(:host, "foo.com")
end

it "should not use html entities to encode the description" do
assign(:alert, mock_model(Alert, :address => "Foo Parade",
:radius_meters => 2000, :confirm_id => "1234", :subscription => nil))
render
rendered.should have_content("Alterations & additions")
end

it "should not show the trial banner if there's no subscription" do
assign(:alert, mock_model(Alert, :address => "Foo Parade",
:radius_meters => 2000, :confirm_id => "1234", :subscription => nil))
render
rendered.should_not have_content("Trial subscription")
end

it "should show the trial banner to trial subscribers" do
subscription = create(:subscription, trial_started_at: Date.today)
assign(:alert, mock_model(Alert, :address => "Foo Parade",
:radius_meters => 2000, :confirm_id => "1234", :subscription => subscription))
render
rendered.should have_content("Trial subscription")
end
end

0 comments on commit d61cc34

Please sign in to comment.