Sha256: 783b9901ee6b78054d988efb90ef57a3ae6aeaf7df07246b9899247b9cc9872e

Contents?: true

Size: 1.06 KB

Versions: 23

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

module Writefully
  describe HooksController do 
    routes { Writefully::Engine.routes }

    let(:github_push_hook)       { open(File.dirname(__FILE__) + "/../../fixtures/writefully/github_push_hook.json").read }
    let(:github_member_add_hook) { open(File.dirname(__FILE__) + "/../../fixtures/writefully/github_member_add_hook.json").read }
  
    before do 
      controller.stub(:check_signature).and_return(true)
    end

    it "should call 'push'" do 
      request.headers["X-Github-Event"] = 'push'
      controller.should_receive(:push).once
      post :create, github_push_hook
      response.should be_success
    end

    it "should call 'member'" do 
      request.headers["X-Github-Event"] = 'member'
      controller.should_receive(:member).once
      post :create, github_member_add_hook
      response.should be_success
    end

    it "should add new authorship" do 
      request.headers["X-Github-Event"] = 'member'
      expect { 
        post :create, github_member_add_hook
      }.to change(Authorship, :count).by(1)
    end
  end 
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
writefully-0.7.1 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.12 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.11 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.10 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.9 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.7 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.6 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.5 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.4 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.3 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.6.2 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.5.1 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.5.0 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.4.10 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.4.8 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.4.7 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.4.6 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.4.5 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.4.4 spec/controllers/writefully/hooks_controller_spec.rb
writefully-0.4.2 spec/controllers/writefully/hooks_controller_spec.rb