Add application controller specs for grammatical gender
This commit is contained in:
parent
08794bc47b
commit
89b51dddf9
1 changed files with 35 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue