githubris 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +5 -2
- data/README.md +16 -1
- data/Rakefile +8 -3
- data/features/list_of_public_gists.feature +12 -0
- data/features/list_of_users_public_gists.feature +14 -0
- data/features/step_definitions/general_steps.rb +20 -0
- data/features/step_definitions/public_gist_steps.rb +0 -0
- data/features/support/env.rb +6 -0
- data/features/support/fakeweb_responses.rb +6 -0
- data/features/support/fixtures.rb +11 -0
- data/features/support/public_gists_page_1.json +884 -0
- data/features/support/public_gists_page_2.json +898 -0
- data/githubris.gemspec +0 -1
- data/lib/githubris/api.rb +38 -20
- data/lib/githubris/builder.rb +31 -22
- data/lib/githubris/comment.rb +1 -1
- data/lib/githubris/gist/file.rb +1 -1
- data/lib/githubris/gist.rb +1 -10
- data/lib/githubris/issue.rb +1 -1
- data/lib/githubris/organization.rb +1 -1
- data/lib/githubris/repository.rb +1 -1
- data/lib/githubris/user.rb +6 -7
- data/lib/githubris/version.rb +2 -2
- data/lib/githubris.rb +17 -16
- data/spec/githubris/api_spec.rb +18 -20
- data/spec/githubris/builder_spec.rb +30 -14
- data/spec/githubris/gist_spec.rb +0 -30
- data/spec/githubris_spec.rb +48 -0
- data/spec/spec_helper.rb +8 -1
- data/spec/support/fakeweb_responses.rb +2 -57
- data/spec/support/fixtures.rb +1 -1
- data/spec/support/public_gists_page_1.json +884 -0
- data/spec/support/public_gists_page_2.json +898 -0
- metadata +17 -8
- data/config/base.yml +0 -1
- data/config/gists.yml +0 -13
- data/config.yml +0 -1
- data/lib/githubris/config.rb +0 -13
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
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
|
2
|
-
require
|
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 =
|
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
|
+
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)
|