Sha256: 167e296836b5c4369ab07f0b07e0109bf851554b3a516c77c4d3c2ff5d02ae67

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require File.expand_path('../spec_helper', __FILE__)

module Danger
  describe Danger::DangerTransifex do
    it 'should be a plugin' do
      expect(Danger::DangerTransifex.new(nil)).to be_a Danger::Plugin
    end

    describe 'with Dangerfile' do
      before do
        @dangerfile = testing_dangerfile
        @my_plugin = @dangerfile.transifex
      end

      context "Failed request" do
        before do
          allow_any_instance_of(Transifex::ResourceComponents::Content).to recieve(:update).with(anything).and raise_error
        end

        it "Warns on fail" do
          @my_plugin.push_source("TXT", "path/to/translations.txt")
          expect(@dangerfile.status_report[:warnings]).to eq(["Updating translations failed \u{274C}"])
        end
      end

      context "Successful request" do
        before do
          allow_any_instance_of(Transifex::ResourceComponents::Content).to recieve(:update).with(anything).and anything
        end

        it "Messages on success" do
          @my_plugin.push_source("TXT", "path/to/translations.txt")
          expect(@dangerfile.status_report[:messages]).to eq(["Translations updated \u{2705}"])
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danger-transifex-0.0.1 spec/transifex_spec.rb