<commit_before>require 'spec_helper'

describe Mailgun::Base do

  before :each do
    @mailgun = Mailgun({:api_key => "some-junk-string"})

    @sample_options = {
      :api_key 	    => @mailgun.api_key,
      :api_version  => @mailgun.api_version,
      :protocol     => @mailgun.protocol,
      :mailgun_host => @mailgun.mailgun_host
    }
  end

  describe "Mailgun.new" do
    it "Mailgun() method should return a new Mailgun object" do
      @mailgun.should be_kind_of(Mailgun::Base)
    end

    it "should use https by default" do
      @mailgun.protocol.should == "https"
    end
  end


  
  describe "resources" do
    
    it "Mailgun#mailboxes should return an instance of Mailgun::Mailbox" do
      @mailgun.mailboxes.should be_kind_of(Mailgun::Mailbox)
    end

    it "Mailgun#routes should return an instance of Mailgun::Route" do
      @mailgun.routes.should be_kind_of(Mailgun::Route)
    end
  end


  
  describe "internal helper methods" do

    describe "Mailgun#base_url" do
      it "should return https url if use_https is true" do
      @mailgun.send(:base_url).should == "https://api:#{@mailgun.api_key}@#{@mailgun.mailgun_host}/#{@mailgun.api_version}"
      end
    end

    describe "Mailgun.submit" do
      it "should send method and arguments to RestClient" do
        RestClient.should_receive(:test_method)
          .with({:arg1=>"val1"},{})
          .and_return({})
        Mailgun.submit :test_method, :arg1=>"val1"
      end
    end
    
  end
end<commit_msg>Updated base_url spec to actually use base_url instead of relying on send which is slower and harder to work out what is going on.<commit_after>require 'spec_helper'

describe Mailgun::Base do

  before :each do
    @mailgun = Mailgun({:api_key => "some-junk-string"})

    @sample_options = {
      :api_key 	    => @mailgun.api_key,
      :api_version  => @mailgun.api_version,
      :protocol     => @mailgun.protocol,
      :mailgun_host => @mailgun.mailgun_host
    }
  end

  describe "Mailgun.new" do
    it "Mailgun() method should return a new Mailgun object" do
      @mailgun.should be_kind_of(Mailgun::Base)
    end

    it "should use https by default" do
      @mailgun.protocol.should == "https"
    end
  end


  
  describe "resources" do
    
    it "Mailgun#mailboxes should return an instance of Mailgun::Mailbox" do
      @mailgun.mailboxes.should be_kind_of(Mailgun::Mailbox)
    end

    it "Mailgun#routes should return an instance of Mailgun::Route" do
      @mailgun.routes.should be_kind_of(Mailgun::Route)
    end
  end


  
  describe "internal helper methods" do

    describe "Mailgun#base_url" do
      it "should return https url if use_https is true" do
      @mailgun.base_url.should == "https://api:#{@mailgun.api_key}@#{@mailgun.mailgun_host}/#{@mailgun.api_version}"
      end
    end

    describe "Mailgun.submit" do
      it "should send method and arguments to RestClient" do
        RestClient.should_receive(:test_method)
          .with({:arg1=>"val1"},{})
          .and_return({})
        Mailgun.submit :test_method, :arg1=>"val1"
      end
    end
    
  end
end
{'fraction_non_alphanumeric': 0.10796915167095116, 'fraction_numerical': 0.002570694087403599, 'mean_word_length': 2.9157232704402514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '609930', 'n_tokens_mistral': 1035, 'n_tokens_neox': 1011, 'n_words': 262}