/**
  *@test
  */
 public function it_returns_the_appropriate_info_if_subscription_fails()
 {
     $mailchimp = Mockery::mock(Spatie\Newsletter\MailChimp\Newsletter::class);
     $mailchimp->shouldReceive('subscribe')->andThrow(\Spatie\Newsletter\Exceptions\AlreadySubscribed::class, '');
     $subscriber = new Subscriber($mailchimp);
     $result = $subscriber->subscribe('*****@*****.**');
     $this->assertEquals(['email' => '*****@*****.**', 'success' => false, 'message' => 'You are already subscribed'], $result);
 }
 public function subscribe(Request $request, Subscriber $subscriber)
 {
     $this->validate($request, ['email' => 'required|email']);
     return response()->json($subscriber->subscribe($request->email));
 }