Skip to content

Commit

Permalink
make app logo account for beta/subscription/custom_install
Browse files Browse the repository at this point in the history
  • Loading branch information
mixmix committed Feb 21, 2015
1 parent 0f7e4a5 commit e42a6ac
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 15 deletions.
16 changes: 16 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,20 @@ def render_help_container
def show_loomio_org_marketing
ENV['SHOW_LOOMIO_ORG_MARKETING']
end

def logo_path
if ENV['APP_LOGO_PATH']
ENV['APP_LOGO_PATH']
else
if hide_beta_logo?
image_url("navbar-logo.png")
else
image_url("navbar-logo-beta.jpg")
end
end
end

def hide_beta_logo?
current_user_or_visitor.belongs_to_manual_subscription_group?
end
end
1 change: 0 additions & 1 deletion app/views/application/_header.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
- logo_path = ENV['APP_LOGO_PATH'] || image_url("navbar-logo-beta.jpg")

%nav.navbar.navbar-default.navbar-fixed-top
.container
Expand Down
25 changes: 19 additions & 6 deletions features/step_definitions/beta_logo_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,30 @@
@subscription_group.add_member! @user
end

Then(/^I should not see the beta logo$/) do
visit group_path(@subscription_group)
page.should_not have_css('.loomio-beta-logo')
end

When(/^I am not a member of a manual subcription group$/) do
@group = FactoryGirl.create(:group)
@group.add_member! @user
end

Then(/^I should see the beta logo$/) do
visit group_path(@group)
page.should have_css('.app-logo.beta')
expect(page.body).to_not match(/navbar-logo\.png/)
end

Then(/^I should not see the beta logo$/) do
visit group_path(@subscription_group)
expect(page.body).to_not match(/navbar-logo-beta\.jpg/)
end

Given(/^my system admin defined us a custom logo$/) do
#GroupsController.any_instance.stub(:logo_path).and_return('www.image_store.com/custom_logo.png')
#binding.pry
ENV['APP_LOGO_PATH'] ='www.image_store.com/custom_logo.png'
#stub_const('ENV', {'APP_LOGO_PATH' => 'asdf'})
end

Then(/^I should see our custom logo instead of any loomio logo$/) do
visit group_path(@group)
expect(page.body).to match(/www\.image_store\.com\/custom_logo\.png/)
end

19 changes: 11 additions & 8 deletions features/users/beta_logo.feature
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
Feature: No beta logo for manual subscription users
As a user
So I can feel like I'm getting value from a professional tool
I want to see the non-beta logo in-app
Feature: App logo is set appropriately in banner

Background:
Given I am logged in

Scenario: Manual Subscription user doesn't see beta logo
When I am a member a manual subcription group
Scenario: Manual Subscription user doesn't see beta logo on loomio.org
And I am a member a manual subcription group
Then I should not see the beta logo

Scenario: All other users see beta logo
When I am not a member of a manual subcription group
Scenario: non-subscription users see beta logo on loomio.org
And I am not a member of a manual subcription group
Then I should see the beta logo

Scenario: private installation of loomio see there own logo
And I am not a member of a manual subcription group
And my system admin defined us a custom logo
Then I should see our custom logo instead of any loomio logo

0 comments on commit e42a6ac

Please sign in to comment.