Merge branch 'next-minor' into develop

This commit is contained in:
Dennis Schubert 2016-09-04 03:02:36 +02:00
commit a7d030e1df
No known key found for this signature in database
GPG key ID: 5A0304BEA7966D7E
4 changed files with 53 additions and 7 deletions

View file

@ -3,7 +3,6 @@
# the COPYRIGHT file.
class TagsController < ApplicationController
skip_before_action :set_grammatical_gender
before_action :ensure_page, :only => :show
helper_method :tag_followed?

View file

@ -1,10 +1,12 @@
@javascript
Feature: Change email
Feature: Change settings
Scenario: Change my email
Background:
Given I am signed in
When I go to the edit user page
And I fill in the following:
Scenario: Change my email
When I fill in the following:
| user_email | new_email@newplac.es |
And I press "Change email"
Then I should see "Email changed"
@ -13,9 +15,13 @@ Feature: Change email
And my "email" should be "new_email@newplac.es"
Scenario: Change my email preferences
Given I am signed in
When I go to the edit user page
And I uncheck "user_email_preferences_mentioned"
When I uncheck "user_email_preferences_mentioned"
And I press "change_email_preferences"
Then I should see "Email notifications changed"
And the "user_email_preferences_mentioned" checkbox should not be checked
Scenario: Change my preferred language
When I select "polski" from "user_language"
And I press "Change language"
Then I should see "Język został zmieniony"
And "polski" should be selected from "user_language"

View file

@ -160,6 +160,12 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |
end
end
Then /^"([^"]*)" should be selected from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
with_scope(selector) do
expect(page).to have_select(field, selected: value)
end
end
Then /^the "([^"]*)" bootstrap-switch should be (on|off)$/ do |label, state|
if state == "on"
expect(page.evaluate_script("$('#{label}').bootstrapSwitch('state')")).to be_truthy

View file

@ -124,4 +124,39 @@ describe ApplicationController, :type => :controller do
expect(@controller.send(:after_sign_out_path_for, alice)).to eq(new_user_session_path)
end
end
describe "#set_grammatical_gender" do
it "is called on page load" do
expect(@controller).to receive(:set_grammatical_gender)
get :index
end
context "for inflected locales" do
before do
alice.language = :pl
alice.save
end
it "returns nil for an empty gender" do
alice.person.profile.gender = ""
alice.person.profile.save
get :index
expect(assigns[:grammatical_gender]).to be_nil
end
it "returns nil for an unrecognized gender" do
alice.person.profile.gender = "robot"
alice.person.profile.save
get :index
expect(assigns[:grammatical_gender]).to be_nil
end
it "sets the correct grammatical gender" do
alice.person.profile.gender = "ona"
alice.person.profile.save
get :index
expect(assigns[:grammatical_gender]).to eq(:f)
end
end
end
end