Sha256: efa56d4b841dd11795c45e3234509620569b579729088b750b8ea042a93919f8

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
require 'rspec_api_documentation/dsl'

resource 'Authorization', focus: true do
  <% if @mandrill %>
  before(:each) { MandrillMailer.deliveries.clear }
  <% end %>
  post '/api/auth/register' do
    example 'New user registration' do
      new_user = FactoryGirl.attributes_for(:user).pick(:display_name, :email)

      do_request(new_user)
      expect(client.response).to succeed
      <% if @mandrill %>
      email = MandrillMailer::deliveries.detect { |mail|
        mail.template_name == 'registration' &&
            mail.message['to'].any? { |to| to['email'] == new_user[:email] }
      }
      <% end %>
      expect(email).to_not be_nil
    end
  end

  post '/api/auth/approve_email' do
    example 'User email activation' do
      user = FactoryGirl.create(:user)
      user.generate_approvement_code!
      user.save!
      do_request(email: user.email, email_approvement_code: user.email_approvement_code)
      expect(client.response).to succeed
      expect(response_body).to include('display_name', 'email')
      <% if @faye %>
      expect(FayePublisher.publishings.length).to eq(1)
      <% end %>
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
grape-gen-0.0.6 template/spec/api/mounts/auth_spec.rb.tt
grape-gen-0.0.5 template/spec/api/mounts/auth_spec.rb.tt
grape-gen-0.0.4 template/spec/api/mounts/auth_spec.rb.tt
grape-gen-0.0.3 template/spec/api/mounts/auth_spec.rb.tt
grape-gen-0.0.2 template/spec/api/mounts/auth_spec.rb.tt
grape-gen-0.0.1 template/spec/api/mounts/auth_spec.rb.tt