Sha256: 154d59a48d08a7291815c0a21b69c3a04f9dc026cc2a3765bb80158e990f35f5

Contents?: true

Size: 730 Bytes

Versions: 3

Compression:

Stored size: 730 Bytes

Contents

describe_fake MediaWiki::Gateway::Files do

  describe "#upload" do

    before do
      @gateway.login('atlasmw', 'wombat')
    end

    describe "when uploading a new file" do

      before do
        @path = 'some/path/sample_image.jpg'
        allow(File).to receive(:new).with(@path).and_return('SAMPLEIMAGEDATA')
        @page = @gateway.upload(@path)
      end

      it "should open the file" do
        File.should have_received(:new).with(@path)
      end

      it "should upload the file" do
        expected = <<-XML
          <api>
            <upload result="Success" filename="sample_image.jpg"/>
          </api>
        XML
        expect(@page.to_s).to be_equivalent_to(expected)
      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mediawiki-gateway-1.1.0 spec/media_wiki/gateway/files_spec.rb
mediawiki-gateway-1.0.0 spec/media_wiki/gateway/files_spec.rb
mediawiki-gateway-1.0.0.rc1 spec/media_wiki/gateway/files_spec.rb