MS DG fix a few final tests
This commit is contained in:
parent
11505a386c
commit
852687b31c
4 changed files with 12 additions and 2 deletions
|
|
@ -29,7 +29,8 @@ class RegistrationsController < Devise::RegistrationsController
|
||||||
|
|
||||||
private
|
private
|
||||||
def check_valid_invite!
|
def check_valid_invite!
|
||||||
return true if invite.can_be_used?
|
return true unless AppConfig[:registrations_closed] #this sucks
|
||||||
|
return true if invite && invite.can_be_used?
|
||||||
flash[:error] = t('registrations.invalid_invite')
|
flash[:error] = t('registrations.invalid_invite')
|
||||||
redirect_to new_user_session_path
|
redirect_to new_user_session_path
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ Feature: invitation acceptance
|
||||||
And I log out
|
And I log out
|
||||||
And I sign in as "bob@bob.bob"
|
And I sign in as "bob@bob.bob"
|
||||||
And I follow "By email"
|
And I follow "By email"
|
||||||
Then I should see "9 invites left"
|
Then I should see one less invite
|
||||||
|
|
||||||
Scenario: sends an invitation
|
Scenario: sends an invitation
|
||||||
Given a user with email "bob@bob.bob"
|
Given a user with email "bob@bob.bob"
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,15 @@ end
|
||||||
|
|
||||||
Given /^I have been invited by bob$/ do
|
Given /^I have been invited by bob$/ do
|
||||||
@inviter = Factory(:user, :email => 'bob@bob.bob')
|
@inviter = Factory(:user, :email => 'bob@bob.bob')
|
||||||
|
@inviter_invite_count = @inviter.invitation_code.count
|
||||||
i = EmailInviter.new("new_invitee@example.com", @inviter)
|
i = EmailInviter.new("new_invitee@example.com", @inviter)
|
||||||
i.send!
|
i.send!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I should see one less invite$/ do
|
||||||
|
step "I should see \"#{@inviter_invite_count -1} invites left\""
|
||||||
|
end
|
||||||
|
|
||||||
When /^I click on my name$/ do
|
When /^I click on my name$/ do
|
||||||
click_link("#{@me.first_name} #{@me.last_name}")
|
click_link("#{@me.first_name} #{@me.last_name}")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ describe RegistrationsController do
|
||||||
|
|
||||||
describe "#create" do
|
describe "#create" do
|
||||||
context "with valid parameters" do
|
context "with valid parameters" do
|
||||||
|
before do
|
||||||
|
AppConfig[:registrations_closed] = false
|
||||||
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
user = Factory.build(:user)
|
user = Factory.build(:user)
|
||||||
User.stub!(:build).and_return(user)
|
User.stub!(:build).and_return(user)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue