Merge pull request #6912 from svbergerem/improve-coverage
Improve coverage
This commit is contained in:
commit
e7657b7f9b
6 changed files with 56 additions and 21 deletions
|
|
@ -1,11 +1,4 @@
|
|||
module ContactsHelper
|
||||
def contact_aspect_dropdown(contact)
|
||||
render :partial => 'people/relationship_action',
|
||||
:locals => { :person => contact.person,
|
||||
:contact => contact,
|
||||
:current_user => current_user }
|
||||
end
|
||||
|
||||
def start_a_conversation_link(aspect, contacts_size)
|
||||
conv_opts = { class: "conversation_button contacts_button"}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,16 +7,4 @@ module GettingStartedHelper
|
|||
def has_completed_getting_started?
|
||||
current_user.getting_started == false
|
||||
end
|
||||
|
||||
def tag_link(tag_name)
|
||||
if tag_followed?(tag_name)
|
||||
link_to "##{tag_name}", tag_followings_path(tag_name), :method => :delete, :class => "featured_tag followed"
|
||||
else
|
||||
link_to "##{tag_name}", tag_tag_followings_path(tag_name), :method => :post, :class => "featured_tag"
|
||||
end
|
||||
end
|
||||
|
||||
def tag_followed?(tag_name)
|
||||
tags.detect{|t| t.name == tag_name}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ Diaspora::Application.routes.draw do
|
|||
get "statistics", to: "node_info#statistics"
|
||||
|
||||
# Terms
|
||||
if AppConfig.settings.terms.enable?
|
||||
if AppConfig.settings.terms.enable? || Rails.env.test?
|
||||
get 'terms' => 'terms#index'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,12 @@ describe AdminsController, :type => :controller do
|
|||
expect(response).to redirect_to user_search_path
|
||||
expect(flash.notice).to include("invitation sent")
|
||||
end
|
||||
|
||||
it "doesn't invite an existing user" do
|
||||
get :admin_inviter, identifier: bob.email
|
||||
expect(response).to redirect_to user_search_path
|
||||
expect(flash.notice).to include("error sending invite")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -94,10 +100,27 @@ describe AdminsController, :type => :controller do
|
|||
Role.add_admin(@user.person)
|
||||
end
|
||||
|
||||
it 'succeeds and renders stats' do
|
||||
it "succeeds and renders stats" do
|
||||
get :stats
|
||||
expect(response).to be_success
|
||||
expect(response).to render_template(:stats)
|
||||
expect(response.body).to include(
|
||||
I18n.translate("admins.stats.display_results", segment: I18n.translate("admins.stats.daily"))
|
||||
)
|
||||
end
|
||||
|
||||
it "succeeds and renders stats for different ranges" do
|
||||
%w(week 2weeks month).each do |range|
|
||||
get :stats, range: range
|
||||
expect(response).to be_success
|
||||
expect(response).to render_template(:stats)
|
||||
expect(response.body).not_to include(
|
||||
I18n.translate("admins.stats.display_results", segment: I18n.translate("admins.stats.daily"))
|
||||
)
|
||||
expect(response.body).to include(
|
||||
I18n.translate("admins.stats.display_results", segment: I18n.translate("admins.stats.#{range}"))
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
16
spec/controllers/help_controller_spec.rb
Normal file
16
spec/controllers/help_controller_spec.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
require "spec_helper"
|
||||
|
||||
describe HelpController, type: :controller do
|
||||
describe "#faq" do
|
||||
it "succeeds" do
|
||||
get :faq
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "fails on mobile" do
|
||||
expect {
|
||||
get :faq, format: :mobile
|
||||
}.to raise_error ActionView::MissingTemplate
|
||||
end
|
||||
end
|
||||
end
|
||||
15
spec/controllers/terms_controller_spec.rb
Normal file
15
spec/controllers/terms_controller_spec.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
require "spec_helper"
|
||||
|
||||
describe TermsController, type: :controller do
|
||||
describe "#index" do
|
||||
it "succeeds" do
|
||||
get :index
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it "succeeds on mobile" do
|
||||
get :index, format: :mobile
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue