githubris 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +7 -0
  3. data/Gemfile +5 -2
  4. data/README.md +16 -1
  5. data/Rakefile +8 -3
  6. data/features/list_of_public_gists.feature +12 -0
  7. data/features/list_of_users_public_gists.feature +14 -0
  8. data/features/step_definitions/general_steps.rb +20 -0
  9. data/features/step_definitions/public_gist_steps.rb +0 -0
  10. data/features/support/env.rb +6 -0
  11. data/features/support/fakeweb_responses.rb +6 -0
  12. data/features/support/fixtures.rb +11 -0
  13. data/features/support/public_gists_page_1.json +884 -0
  14. data/features/support/public_gists_page_2.json +898 -0
  15. data/githubris.gemspec +0 -1
  16. data/lib/githubris/api.rb +38 -20
  17. data/lib/githubris/builder.rb +31 -22
  18. data/lib/githubris/comment.rb +1 -1
  19. data/lib/githubris/gist/file.rb +1 -1
  20. data/lib/githubris/gist.rb +1 -10
  21. data/lib/githubris/issue.rb +1 -1
  22. data/lib/githubris/organization.rb +1 -1
  23. data/lib/githubris/repository.rb +1 -1
  24. data/lib/githubris/user.rb +6 -7
  25. data/lib/githubris/version.rb +2 -2
  26. data/lib/githubris.rb +17 -16
  27. data/spec/githubris/api_spec.rb +18 -20
  28. data/spec/githubris/builder_spec.rb +30 -14
  29. data/spec/githubris/gist_spec.rb +0 -30
  30. data/spec/githubris_spec.rb +48 -0
  31. data/spec/spec_helper.rb +8 -1
  32. data/spec/support/fakeweb_responses.rb +2 -57
  33. data/spec/support/fixtures.rb +1 -1
  34. data/spec/support/public_gists_page_1.json +884 -0
  35. data/spec/support/public_gists_page_2.json +898 -0
  36. metadata +17 -8
  37. data/config/base.yml +0 -1
  38. data/config/gists.yml +0 -13
  39. data/config.yml +0 -1
  40. data/lib/githubris/config.rb +0 -13
data/.gitignore CHANGED
@@ -3,3 +3,4 @@ tags
3
3
  .bundle
4
4
  Gemfile.lock
5
5
  pkg/*
6
+ coverage/*
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - jruby-19mode
6
+ - ruby-head
7
+ - jruby-head
data/Gemfile CHANGED
@@ -5,7 +5,10 @@ group :development, :test do
5
5
  gem 'rspec', '~> 2.8.0'
6
6
  gem 'rspec-spies'
7
7
  gem 'fakeweb'
8
- gem 'pry'
9
- gem 'pry-doc'
8
+ gem 'simplecov'
10
9
  end
10
+
11
+ gem 'jruby-openssl', platform: 'jruby'
12
+
13
+ gem 'rake'
11
14
  gemspec
data/README.md CHANGED
@@ -1,3 +1,18 @@
1
- #Githubris
1
+ #Githubris [![Build Status](https://secure.travis-ci.org/isaacsanders/githubris.png?branch=master)](http://travis-ci.org/isaacsanders/githubris)
2
2
 
3
3
  This is the best github API wrapper ever.
4
+
5
+ ##Contributing
6
+
7
+ There are a couple of ways that you can contribute to Githubris. For example:
8
+
9
+ 1. You can take a bug and verify the replication steps
10
+ 2. You can take a verified bug and add acceptance criteria to a feature, so we
11
+ have test coverage against it in the future.
12
+ 3. You can take an unassigned feature and implement the tests and code to make
13
+ them pass.
14
+ 4. You can be part of a discussion on any of the Issues marked as a
15
+ ```feature```
16
+ 5. You can open pull requests to pull in your contributions
17
+ 6. You can correct typos or grammar issues.
18
+ 7. You can help in __any__ way you want!
data/Rakefile CHANGED
@@ -1,8 +1,13 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'cucumber/rake/task'
3
4
 
4
5
  RSpec::Core::RakeTask.new :spec do |t|
5
- t.rspec_opts = "--color --format=documentation"
6
+ t.rspec_opts = '--color --format=documentation'
7
+ end
8
+
9
+ Cucumber::Rake::Task.new :features do |t|
10
+ t.cucumber_opts = '--tags ~@wip --tags ~@backlog'
6
11
  end
7
12
 
8
13
  task :default => :spec
@@ -0,0 +1,12 @@
1
+ Feature: List of Public Gists
2
+ In order to evaluate the data created by gist makers
3
+ As a developer
4
+ I want to be able to see a list of public gists
5
+
6
+ Scenario: Asking for public gists
7
+ When I access "@githubris.public_gists"
8
+ Then I should have a default number of gists
9
+
10
+ Scenario: Asking for a certain quantity of public gists
11
+ When I access "@githubris.public_gists(quantity: 47)"
12
+ Then I should have 47 gists
@@ -0,0 +1,14 @@
1
+ @backlog
2
+ Feature: List of user's public gists
3
+ In order to view all of the public gists another user has made,
4
+ As a user of the Githubris GitHub API,
5
+ I want to be able to access the gists via the API.
6
+
7
+ Scenario: via Githubris
8
+ When I access "@githubris.public_gists(user: 'GithubrisTestUser')"
9
+ Then I have GithubrisTestUser's public gists
10
+
11
+ Scenario: via the User
12
+ Given @user is GithubrisTestUser
13
+ When I access "@user.public_gists"
14
+ Then I have GithubrisTestUser's public gists
@@ -0,0 +1,20 @@
1
+ Given /^@user is GithubrisTestUser$/ do
2
+ @user = @githubris.find_user('GithubrisTestUser')
3
+ end
4
+
5
+ When /^I access "([^"]*)"$/ do |api_code|
6
+ @actual = binding.eval api_code
7
+ end
8
+
9
+ Then /^I have GithubrisTestUser's public gists$/ do
10
+ @actual.should eql test_public_gists
11
+ end
12
+
13
+ Then /^I should have a default number of gists$/ do
14
+ @actual.count.should eql 30
15
+ end
16
+
17
+ Then /^I should have (\d+) gists$/ do |count|
18
+ @actual.count.should eql Integer(count)
19
+ end
20
+
File without changes
@@ -0,0 +1,6 @@
1
+ $:.push '../../support'
2
+
3
+ require 'githubris'
4
+ Before do
5
+ @githubris = Githubris.new
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'fakeweb'
2
+
3
+ FakeWeb.allow_net_connect = false
4
+ FakeWeb.register_uri(:get, 'https://api.github.com/', :body => '{}')
5
+ FakeWeb.register_uri(:get, /gists\/public(?:[^?]*\?page=(\d+))?/,
6
+ :body => File.open("features/support/public_gists_page_#{$1 || 1}.json", 'r') {|f| f.read })
@@ -0,0 +1,11 @@
1
+ module Fixtures
2
+ def test_public_gists
3
+ Githubris::Builder.new.build get_public_gists_data
4
+ end
5
+
6
+ def get_public_gists_data(page=1)
7
+ MultiJson.decode(File.open("features/support/public_gists_page_#{page}.json") {|f| f.read })
8
+ end
9
+ end
10
+
11
+ World(Fixtures)