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
|
||||
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')
|
||||
redirect_to new_user_session_path
|
||||
end
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Feature: invitation acceptance
|
|||
And I log out
|
||||
And I sign in as "bob@bob.bob"
|
||||
And I follow "By email"
|
||||
Then I should see "9 invites left"
|
||||
Then I should see one less invite
|
||||
|
||||
Scenario: sends an invitation
|
||||
Given a user with email "bob@bob.bob"
|
||||
|
|
|
|||
|
|
@ -34,10 +34,15 @@ end
|
|||
|
||||
Given /^I have been invited by bob$/ do
|
||||
@inviter = Factory(:user, :email => 'bob@bob.bob')
|
||||
@inviter_invite_count = @inviter.invitation_code.count
|
||||
i = EmailInviter.new("new_invitee@example.com", @inviter)
|
||||
i.send!
|
||||
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
|
||||
click_link("#{@me.first_name} #{@me.last_name}")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@ describe RegistrationsController do
|
|||
|
||||
describe "#create" do
|
||||
context "with valid parameters" do
|
||||
before do
|
||||
AppConfig[:registrations_closed] = false
|
||||
end
|
||||
|
||||
before do
|
||||
user = Factory.build(:user)
|
||||
User.stub!(:build).and_return(user)
|
||||
|
|
|
|||
Loading…
Reference in a new issue