Skip to content

Instantly share code, notes, and snippets.

@CoralineAda
Created October 8, 2015 15:46
Show Gist options
  • Save CoralineAda/9998fa097ab84551fb7a to your computer and use it in GitHub Desktop.
Save CoralineAda/9998fa097ab84551fb7a to your computer and use it in GitHub Desktop.
(begin
(send nil :require
(str "spec_helper"))
(block
(send nil :describe
(const nil :Project))
(args)
(begin
(block
(send nil :describe
(str "#update"))
(args)
(begin
(block
(send nil :let
(sym :project))
(args)
(send
(const nil :Project) :new))
(block
(send nil :before)
(args)
(begin
(send
(send nil :project) :repo_url=
(str "http://foo.com/foo/bar"))
(send
(send nil :allow
(send nil :project)) :to
(send
(send nil :receive
(sym :update_attributes)) :and_return
(true)))))
(block
(send nil :it
(str "fetches a repo"))
(args)
(begin
(send
(send nil :allow
(const nil :Octokit)) :to
(send
(send nil :receive
(sym :repo)) :with
(str "foo/bar")))
(send
(send nil :project) :update)))
(block
(send nil :it
(str "handles errors"))
(args)
(begin
(send
(send nil :expect
(const nil :Octokit)) :to
(send
(send nil :receive
(sym :repo)) :and_raise
(str "foo")))
(send
(send nil :project) :update)
(lvasgn :error
(send
(send
(send
(send nil :project) :errors) :full_messages) :first))
(send
(send nil :expect
(send
(lvar :error) :include?
(str "foo"))) :to
(send nil :be_truthy))))))
(block
(send nil :describe
(str "#repo_path"))
(args)
(begin
(block
(send nil :let
(sym :project))
(args)
(send
(const nil :Project) :new
(hash
(pair
(sym :repo_url)
(str "https://foo.com/Bantik/foo")))))
(block
(send nil :it
(str "extracts the path from a URL"))
(args)
(send
(send nil :expect
(send
(send nil :project) :repo_path)) :to
(send nil :eq
(str "Bantik/foo")))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment