Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
97b97e9
Add "quickstart" samples.
jmdobry Sep 14, 2016
beab134
Tweak Datastore quickstart sample.
jmdobry Oct 5, 2016
318d761
Tweak Datastore quickstart sample.
jmdobry Oct 5, 2016
bb13651
Change datastore quickstart sample to create a task.
jmdobry Oct 6, 2016
a44f362
Changes:
Oct 6, 2016
48b30fe
Changes:
Oct 6, 2016
4bcdf07
Changes:
Oct 7, 2016
4f1b02c
Changes:
Oct 7, 2016
e81e741
Changes:
Oct 7, 2016
2590342
Changes:
Oct 8, 2016
5e9c228
Changes:
Oct 8, 2016
740c7cd
Simplify print statement in Vision quickstart.
jmdobry Oct 10, 2016
ca30bc2
Changes:
Oct 10, 2016
b41be6a
Changes:
Oct 10, 2016
252f7a0
Changes:
Oct 10, 2016
88e99a5
Changes:
Oct 10, 2016
c82d70c
Changes:
Oct 10, 2016
b426429
Changes:
Oct 10, 2016
135527c
Changes:
Oct 10, 2016
99c4689
Changes:
Oct 10, 2016
c389c77
Changes:
Oct 11, 2016
019932c
Changes:
Oct 11, 2016
87386ef
Changes:
Oct 11, 2016
2d1367f
Changes:
Oct 11, 2016
71a0f2f
Changes:
Oct 11, 2016
c2994e0
Changes:
Oct 11, 2016
73fdf64
Removed extra spaces in logging/quickstart.rb
Oct 11, 2016
97f366e
Removed %Q{} and used single-quotes instead
Oct 11, 2016
3249d27
Removed spaces from assignment in trasnlate
Oct 11, 2016
e522da5
Removed multiple label lookup in Vision quickstart_spec.rb (using cat)!
Oct 12, 2016
01cd1d8
Added wait_until helper function and removed direct call to sleep
Oct 12, 2016
183ef4b
Changes:
Oct 12, 2016
7b31107
Merge branch 'master' of github.com:GoogleCloudPlatform/ruby-docs-sam…
Oct 12, 2016
a450c94
Changes:
Oct 12, 2016
4881ae7
Modified expectation to attempt to fix Travis CI
Oct 13, 2016
1e97352
Refactor Logging Quickstart spec and fix by adding order clause to en…
Oct 13, 2016
a06b18a
Merge pull request #90 from GoogleCloudPlatform/logging-quickstart-spec
frankyn Oct 13, 2016
c0586e7
Removed some spacing found by Vim
Oct 13, 2016
73b620b
Changed %{} to %Q{} to be more explicit.
Oct 14, 2016
0a17905
Removed order from filter. Using full project path
Oct 18, 2016
0e6e529
Modified quickstart spec test to check poliarity
Oct 19, 2016
b7eef07
Language Removed _client, _test_client, and shabang line
Oct 20, 2016
3447327
Speech quickstart changed fileName -> file_name
Oct 20, 2016
ff23358
Vision quickstart: changed fileName -> file_name
Oct 20, 2016
64953d3
Vision quickstart spec: added better description
Oct 20, 2016
5796925
Language/quickstart.rb Remove unwanted spacing.
Oct 20, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bigquery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ analytics data warehouse.

## Samples

### Quickstart

'''
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these single quotes for?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a incorrectly typed symbol. (I meant to use an apostrophe). I since have removed them, because Remi and I decided not to have them in the README for now.

quickstart.rb provides a literal quick start using BigQuery
'''


### Datasets

```
Expand Down Expand Up @@ -36,3 +43,8 @@ Commands:
query <query>
query_job <query>
```

### Run all tests
```
$ bundle exec rspec
```
57 changes: 57 additions & 0 deletions bigquery/spec/quickstart_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2016 Google, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require_relative "../quickstart"
require "google/cloud"

describe "Quickstart" do
# Initialize dataset_name
DATASET_NAME = 'dataset_name'

# Setup 'before' RSpec hook
before :all do
@gcloud = Google::Cloud.new ENV['GOOGLE_PROJECT_ID']
@bigquery = @gcloud.bigquery
@dataset = @bigquery.create_dataset DATASET_NAME
end

# Setup 'after' RSpec hook
RSpec.configure do |config|
config.after do
cleanup!
end
end

# Cleanup!
def cleanup!
# Delete dataset
@dataset.delete
end

# Test Quickstart sample
it 'creates a new dataset in BigQuery' do
# Setup expectations for Google::Cloud
expect(Google::Cloud).to receive(:new).with("YOUR_PROJECT_ID").and_return(@gcloud)

# Setup expectations for @gcloud
expect(@gcloud).to receive(:bigquery).and_return(@bigquery)

# Setup expectations for @bigquery
expect(@bigquery).to receive(:create_dataset).with("my_new_dataset").and_return(@dataset)

# Check output
expect{ run_quickstart }.to output(/#{DATASET_NAME}/).to_stdout
end
end