kuva 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +11 -10
- data/app/assets/stylesheets/kuva/{base.css.sass → base.sass} +0 -0
- data/lib/kuva/version.rb +1 -1
- metadata +37 -280
- data/.coveralls.yml +0 -1
- data/.env.example +0 -4
- data/.gitignore +0 -14
- data/.rspec +0 -1
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.travis.yml +0 -12
- data/Gemfile.lock +0 -191
- data/MIT-LICENSE +0 -20
- data/kuva.gemspec +0 -26
- data/spec/controllers/kuva/application_controller_spec.rb +0 -42
- data/spec/controllers/kuva/photos_controller_spec.rb +0 -22
- data/spec/controllers/kuva/sets_controller_spec.rb +0 -51
- data/spec/dummy/README.md +0 -1
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -30
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -29
- data/spec/dummy/config/environments/production.rb +0 -80
- data/spec/dummy/config/environments/test.rb +0 -39
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/kuva.rb +0 -29
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -4
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +0 -58
- data/spec/dummy/public/422.html +0 -58
- data/spec/dummy/public/500.html +0 -57
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/features/photo_spec.rb +0 -40
- data/spec/features/photoset_collection_spec.rb +0 -25
- data/spec/features/photoset_spec.rb +0 -42
- data/spec/generators/kuva/assets_generator_spec.rb +0 -30
- data/spec/generators/kuva/install_generator_spec.rb +0 -63
- data/spec/generators/kuva/views_generator_spec.rb +0 -37
- data/spec/helpers/kuva/application_helper_spec.rb +0 -26
- data/spec/kuva/authorizer_spec.rb +0 -83
- data/spec/kuva/elements/photo_spec.rb +0 -76
- data/spec/kuva/elements/photoset_collection_spec.rb +0 -42
- data/spec/kuva/elements/photoset_spec.rb +0 -106
- data/spec/kuva/elements/url_info_spec.rb +0 -25
- data/spec/kuva_spec.rb +0 -81
- data/spec/spec_helper.rb +0 -68
- data/spec/support/vcr/cassettes/Kuva_ApplicationController/configuring_Kuva/sets_the_API_key.yml +0 -160
- data/spec/support/vcr/cassettes/Kuva_ApplicationController/configuring_Kuva/sets_the_access_secret.yml +0 -160
- data/spec/support/vcr/cassettes/Kuva_ApplicationController/configuring_Kuva/sets_the_access_token.yml +0 -160
- data/spec/support/vcr/cassettes/Kuva_ApplicationHelper/_breadcrumbs_for/when_the_current_page_is_NOT_the_set_page/creates_a_breadcrumb_with_the_set_URL.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_ApplicationHelper/_breadcrumbs_for/when_the_current_page_is_the_set_page/creates_a_breadcrumb_without_the_set_URL.yml +0 -222
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_find/fetches_the_photo_from_Flickr_specified_by_id.yml +0 -95
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_find/instantiates_a_new_Kuva_Elements_Photo_object.yml +0 -252
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/does_NOT_set_the_is_primary_boolean.yml +0 -252
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/returns_itself.yml +0 -95
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_description.yml +0 -95
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_farm.yml +0 -95
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_id.yml +0 -95
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_secret.yml +0 -95
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_server.yml +0 -252
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/_initialize/saves_a_reference_to_the_title.yml +0 -95
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/image_URLs/generates_an_image_URL_for_a_default_sized_medium_image.yml +0 -95
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/image_URLs/generates_an_image_URL_for_a_n-sized_small_320_image.yml +0 -252
- data/spec/support/vcr/cassettes/Kuva_Elements_Photo/image_URLs/instantiates_a_new_URL_info_object_to_create_image_URLs.yml +0 -95
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_find/fetches_the_photoset_from_Flickr_specified_by_id.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_find/instantiates_a_new_Kuva_Elements_Photoset_object.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_image_url/generates_an_image_URL_for_a_large_square_image.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_image_url/instantiates_a_new_URL_info_object_to_create_an_image_URL.yml +0 -222
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/returns_itself.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_created_at_date.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_description.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_farm.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_id.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_number_of_photos.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_number_of_views.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_primary_id.yml +0 -222
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_secret.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_server.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_title.yml +0 -222
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_initialize/saves_a_reference_to_the_updated_at_date.yml +0 -65
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_with_photos/returns_an_array.yml +0 -162
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_with_photos/returns_an_array_with_the_size_specified_by_number_of_photos.yml +0 -162
- data/spec/support/vcr/cassettes/Kuva_Elements_Photoset/_with_photos/wraps_the_photos_into_a_Kuva_Elements_Photo_element.yml +0 -319
- data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_photosets/retrieves_all_photosets.yml +0 -2761
- data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_photosets/returns_an_array.yml +0 -2918
- data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_photosets/wraps_the_photosets_into_a_Kuva_Elements_Photoset_element.yml +0 -2761
- data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_retrieve/fetches_all_photosets_from_Flickr.yml +0 -2918
- data/spec/support/vcr/cassettes/Kuva_Elements_PhotosetCollection/_retrieve/instantiates_a_new_Kuva_Elements_PhotosetCollection_object.yml +0 -2761
- data/spec/support/vcr/cassettes/Kuva_PhotosController/_show/assigns_the_photo.yml +0 -314
- data/spec/support/vcr/cassettes/Kuva_PhotosController/_show/finds_the_photo.yml +0 -157
- data/spec/support/vcr/cassettes/Kuva_SetsController/_index/assigns_the_photoset_collection_with_photosets.yml +0 -2761
- data/spec/support/vcr/cassettes/Kuva_SetsController/_index/knows_its_type.yml +0 -2918
- data/spec/support/vcr/cassettes/Kuva_SetsController/_index/retrieves_the_entire_photoset_collection.yml +0 -160
- data/spec/support/vcr/cassettes/Kuva_SetsController/_show/assigns_the_photos_of_the_specified_photoset.yml +0 -2858
- data/spec/support/vcr/cassettes/Kuva_SetsController/_show/finds_the_specified_photoset_within_the_entire_photoset_collection.yml +0 -2858
- data/spec/support/vcr/cassettes/Kuva_SetsController/_show/knows_its_type.yml +0 -2858
- data/spec/support/vcr/cassettes/photo/navigating_back_to_the_photoset_page.yml +0 -3169
- data/spec/support/vcr/cassettes/photo/viewing_the_first_photo_of_the_photoset.yml +0 -157
- data/spec/support/vcr/cassettes/photoset/navigating_back_to_the_photoset_collection_page.yml +0 -5616
- data/spec/support/vcr/cassettes/photoset/navigating_to_the_page_with_details_of_the_first_photo.yml +0 -3012
- data/spec/support/vcr/cassettes/photoset/viewing_the_first_photo_of_the_photoset.yml +0 -314
- data/spec/support/vcr/cassettes/photoset/viewing_the_first_photoset_of_the_photoset_collection.yml +0 -3015
- data/spec/support/vcr/cassettes/photoset_collection/navigating_to_the_page_with_photos_of_the_first_photoset.yml +0 -5616
- data/spec/support/vcr/cassettes/photoset_collection/viewing_the_photoset_collection.yml +0 -2761
- data/spec/support/vcr/vcr.rb +0 -17
@@ -1,76 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require "spec_helper"
|
3
|
-
|
4
|
-
module Kuva
|
5
|
-
module Elements
|
6
|
-
describe Photo, :vcr do
|
7
|
-
|
8
|
-
let(:photo_id) { "8317914535" }
|
9
|
-
|
10
|
-
context "#initialize" do
|
11
|
-
subject { described_class.find photo_id }
|
12
|
-
|
13
|
-
it "saves a reference to the id" do
|
14
|
-
expect(subject.id).to eq "8317914535"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "saves a reference to the title" do
|
18
|
-
expect(subject.title).to eq "Musée du Louvre"
|
19
|
-
end
|
20
|
-
|
21
|
-
it "saves a reference to the description" do
|
22
|
-
expect(subject.description).to eq "These shots were taken in Paris, France in December 2012. Most of them are taken with my Nikon D80 and Nikkor 50mm f/1.8 or Tokina 12-24mm f/4."
|
23
|
-
end
|
24
|
-
|
25
|
-
it "saves a reference to the farm" do
|
26
|
-
expect(subject.farm).to eq 9
|
27
|
-
end
|
28
|
-
|
29
|
-
it "saves a reference to the server" do
|
30
|
-
expect(subject.server).to eq "8217"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "saves a reference to the secret" do
|
34
|
-
expect(subject.secret).to eq "c7393787f3"
|
35
|
-
end
|
36
|
-
|
37
|
-
it "does NOT set the is_primary boolean" do
|
38
|
-
expect(subject.is_primary).to be_nil
|
39
|
-
end
|
40
|
-
|
41
|
-
it "returns itself" do
|
42
|
-
expect(subject).to be_a Kuva::Elements::Photo
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context ".find" do
|
47
|
-
it "fetches the photo from Flickr specified by id" do
|
48
|
-
expect(flickr.photos).to receive(:getInfo).with(photo_id: photo_id).and_call_original
|
49
|
-
described_class.find photo_id
|
50
|
-
end
|
51
|
-
|
52
|
-
it "instantiates a new #{described_class} object" do
|
53
|
-
expect(described_class).to receive(:new).with(any_args).and_call_original
|
54
|
-
described_class.find photo_id
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context "image URLs" do
|
59
|
-
subject { described_class.find photo_id }
|
60
|
-
|
61
|
-
it "instantiates a new URL info object to create image URLs" do
|
62
|
-
expect(Kuva::Elements::UrlInfo).to receive(:new).with(any_args).and_call_original
|
63
|
-
subject.url
|
64
|
-
end
|
65
|
-
|
66
|
-
it "generates an image URL for a default sized (medium) image" do
|
67
|
-
expect(subject.url).to eq "https://farm9.staticflickr.com/8217/8317914535_c7393787f3.jpg"
|
68
|
-
end
|
69
|
-
|
70
|
-
it "generates an image URL for a n-sized (small 320) image" do
|
71
|
-
expect(subject.url_n).to eq "https://farm9.staticflickr.com/8217/8317914535_c7393787f3_n.jpg"
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module Kuva
|
4
|
-
module Elements
|
5
|
-
describe PhotosetCollection, :vcr do
|
6
|
-
|
7
|
-
describe ".retrieve" do
|
8
|
-
subject { described_class.retrieve }
|
9
|
-
|
10
|
-
it "fetches all photosets from Flickr" do
|
11
|
-
expect(flickr.photosets).to receive(:getList).and_call_original
|
12
|
-
subject
|
13
|
-
end
|
14
|
-
|
15
|
-
it "instantiates a new #{described_class} object" do
|
16
|
-
expect(described_class).to receive(:new).and_call_original
|
17
|
-
subject
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "#photosets" do
|
22
|
-
subject { described_class.new.photosets }
|
23
|
-
|
24
|
-
it "retrieves all photosets" do
|
25
|
-
expect(flickr.photosets).to receive(:getList).and_call_original
|
26
|
-
subject
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns an array" do
|
30
|
-
expect(subject).to be_an Array
|
31
|
-
end
|
32
|
-
|
33
|
-
it "wraps the photosets into a Kuva::Elements::Photoset element" do
|
34
|
-
subject.each do |photoset|
|
35
|
-
expect(photoset).to be_a Kuva::Elements::Photoset
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,106 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module Kuva
|
4
|
-
module Elements
|
5
|
-
describe Photoset, :vcr do
|
6
|
-
|
7
|
-
let(:photoset_id) { "72157632367381040" }
|
8
|
-
|
9
|
-
context "#initialize" do
|
10
|
-
subject { described_class.find photoset_id }
|
11
|
-
|
12
|
-
it "saves a reference to the id" do
|
13
|
-
expect(subject.id).to eq "72157632367381040"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "saves a reference to the title" do
|
17
|
-
expect(subject.title).to eq "Paris"
|
18
|
-
end
|
19
|
-
|
20
|
-
it "saves a reference to the description" do
|
21
|
-
expect(subject.description).to eq "These shots were taken in Paris, France in December 2012. Most of them are taken with my Nikon D80 and Nikkor 50mm f/1.8 or Tokina 12-24mm f/4."
|
22
|
-
end
|
23
|
-
|
24
|
-
it "saves a reference to the number of views" do
|
25
|
-
expect(subject.views).to eq "31"
|
26
|
-
end
|
27
|
-
|
28
|
-
it "saves a reference to the number of photos" do
|
29
|
-
expect(subject.number_of_photos).to eq 28
|
30
|
-
end
|
31
|
-
|
32
|
-
it "saves a reference to the farm" do
|
33
|
-
expect(subject.farm).to eq 9
|
34
|
-
end
|
35
|
-
|
36
|
-
it "saves a reference to the server" do
|
37
|
-
expect(subject.server).to eq "8499"
|
38
|
-
end
|
39
|
-
|
40
|
-
it "saves a reference to the secret" do
|
41
|
-
expect(subject.secret).to eq "eda82f692f"
|
42
|
-
end
|
43
|
-
|
44
|
-
it "saves a reference to the primary id" do
|
45
|
-
expect(subject.primary).to eq "8318972536"
|
46
|
-
end
|
47
|
-
|
48
|
-
it "saves a reference to the created at date" do
|
49
|
-
expect(subject.created_at).to eq "1356715289"
|
50
|
-
end
|
51
|
-
|
52
|
-
it "saves a reference to the updated at date" do
|
53
|
-
expect(subject.updated_at).to eq "1356717162"
|
54
|
-
end
|
55
|
-
|
56
|
-
it "returns itself" do
|
57
|
-
expect(subject).to be_a Kuva::Elements::Photoset
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context ".find" do
|
62
|
-
it "fetches the photoset from Flickr specified by id" do
|
63
|
-
expect(flickr.photosets).to receive(:getInfo).with(photoset_id: photoset_id).and_call_original
|
64
|
-
described_class.find photoset_id
|
65
|
-
end
|
66
|
-
|
67
|
-
it "instantiates a new #{described_class} object" do
|
68
|
-
expect(described_class).to receive(:new).with(any_args).and_call_original
|
69
|
-
described_class.find photoset_id
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "#with_photos" do
|
74
|
-
subject { described_class.find photoset_id }
|
75
|
-
|
76
|
-
it "returns an array" do
|
77
|
-
expect(subject.with_photos).to be_an Array
|
78
|
-
end
|
79
|
-
|
80
|
-
it "returns an array with the size specified by number of photos" do
|
81
|
-
expect(subject.with_photos.size).to eq subject.number_of_photos
|
82
|
-
end
|
83
|
-
|
84
|
-
it "wraps the photos into a Kuva::Elements::Photo element" do
|
85
|
-
subject.with_photos.each do |photo|
|
86
|
-
expect(photo).to be_a Kuva::Elements::Photo
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
context "#image_url" do
|
92
|
-
subject { described_class.find photoset_id }
|
93
|
-
|
94
|
-
it "instantiates a new URL info object to create an image URL" do
|
95
|
-
expect(Kuva::Elements::UrlInfo).to receive(:new).with(any_args).and_call_original
|
96
|
-
subject.image_url
|
97
|
-
end
|
98
|
-
|
99
|
-
it "generates an image URL for a large square image" do
|
100
|
-
expect(subject.image_url).to eq "https://farm9.staticflickr.com/8499/8318972536_eda82f692f_q.jpg"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module Kuva
|
4
|
-
module Elements
|
5
|
-
describe UrlInfo do
|
6
|
-
subject { described_class.new "8317914535", "9", "8217", "c7393787f3" }
|
7
|
-
|
8
|
-
it "knows its id" do
|
9
|
-
expect(subject.id).to eq "8317914535"
|
10
|
-
end
|
11
|
-
|
12
|
-
it "knows its farm" do
|
13
|
-
expect(subject.farm).to eq "9"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "knows its server" do
|
17
|
-
expect(subject.server).to eq "8217"
|
18
|
-
end
|
19
|
-
|
20
|
-
it "knows its secret" do
|
21
|
-
expect(subject.secret).to eq "c7393787f3"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/kuva_spec.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Kuva do
|
4
|
-
|
5
|
-
describe ".setup" do
|
6
|
-
it "yields itself" do
|
7
|
-
Kuva.setup do |config|
|
8
|
-
expect(config).to eq Kuva
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
context "setup block" do
|
14
|
-
before do
|
15
|
-
@old_api_key = Kuva.api_key
|
16
|
-
@old_shared_secret = Kuva.shared_secret
|
17
|
-
@old_access_token = Kuva.access_token
|
18
|
-
@old_access_secret = Kuva.access_secret
|
19
|
-
@old_cache_expiration = Kuva.cache_expiration
|
20
|
-
end
|
21
|
-
|
22
|
-
it "configures the API key" do
|
23
|
-
Kuva.setup do |config|
|
24
|
-
config.api_key = "kuva-api-key"
|
25
|
-
end
|
26
|
-
|
27
|
-
expect(Kuva.api_key).to eq "kuva-api-key"
|
28
|
-
end
|
29
|
-
|
30
|
-
it "configures the shared secret" do
|
31
|
-
Kuva.setup do |config|
|
32
|
-
config.shared_secret = "super-secret"
|
33
|
-
end
|
34
|
-
|
35
|
-
expect(Kuva.shared_secret).to eq "super-secret"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "configures the access token" do
|
39
|
-
Kuva.setup do |config|
|
40
|
-
config.access_token = "access-token"
|
41
|
-
end
|
42
|
-
|
43
|
-
expect(Kuva.access_token).to eq "access-token"
|
44
|
-
end
|
45
|
-
|
46
|
-
it "configures the access secret" do
|
47
|
-
Kuva.setup do |config|
|
48
|
-
config.access_secret = "secret-access-token"
|
49
|
-
end
|
50
|
-
|
51
|
-
expect(Kuva.access_secret).to eq "secret-access-token"
|
52
|
-
end
|
53
|
-
|
54
|
-
it "configures the cache expiration" do
|
55
|
-
Kuva.setup do |config|
|
56
|
-
config.cache_expiration = "cache-expiration"
|
57
|
-
end
|
58
|
-
|
59
|
-
expect(Kuva.cache_expiration).to eq "cache-expiration"
|
60
|
-
end
|
61
|
-
|
62
|
-
after do
|
63
|
-
Kuva.setup do |config|
|
64
|
-
config.api_key = @old_api_key
|
65
|
-
config.shared_secret = @old_shared_secret
|
66
|
-
config.access_token = @old_access_token
|
67
|
-
config.access_secret = @old_access_secret
|
68
|
-
config.cache_expiration = @old_cache_expiration
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "default configuration" do
|
74
|
-
describe "cache expiration" do
|
75
|
-
it "knows its default cache expiration" do
|
76
|
-
expect(Kuva.cache_expiration).to eq 7.days
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
require "simplecov"
|
2
|
-
require "coveralls"
|
3
|
-
|
4
|
-
SimpleCov.formatter = Coveralls::SimpleCov::Formatter
|
5
|
-
SimpleCov.start do
|
6
|
-
add_filter "/spec"
|
7
|
-
end
|
8
|
-
|
9
|
-
# This file is copied to spec/ when you run "rails generate rspec:install"
|
10
|
-
ENV["RAILS_ENV"] ||= "test"
|
11
|
-
require File.expand_path("../dummy/config/environment", __FILE__) if Dir.exists?("spec/dummy")
|
12
|
-
require "rspec/rails"
|
13
|
-
require "rspec/autorun"
|
14
|
-
require "capybara/rails"
|
15
|
-
|
16
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
17
|
-
# in spec/support/ and its subdirectories.
|
18
|
-
ENGINE_RAILS_ROOT = File.join File.dirname(__FILE__), "../"
|
19
|
-
Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each { |file| require file }
|
20
|
-
|
21
|
-
# Checks for pending migrations before tests are run.
|
22
|
-
# If you are not using ActiveRecord, you can remove this line.
|
23
|
-
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
24
|
-
|
25
|
-
RSpec.configure do |config|
|
26
|
-
|
27
|
-
# setup the flickr configuration for the specs
|
28
|
-
config.before do
|
29
|
-
FlickRaw.api_key = Kuva.api_key = ENV["KUVA_API_KEY"]
|
30
|
-
FlickRaw.shared_secret = Kuva.shared_secret = ENV["KUVA_SHARED_SECRET"]
|
31
|
-
flickr.access_token = Kuva.access_token = ENV["KUVA_ACCESS_TOKEN"]
|
32
|
-
flickr.access_secret = Kuva.access_secret = ENV["KUVA_ACCESS_SECRET"]
|
33
|
-
end
|
34
|
-
|
35
|
-
# instead of specifying ":vcr => true", we can specify just ":vcr"
|
36
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
37
|
-
|
38
|
-
# ## Mock Framework
|
39
|
-
#
|
40
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
41
|
-
#
|
42
|
-
# config.mock_with :mocha
|
43
|
-
# config.mock_with :flexmock
|
44
|
-
# config.mock_with :rr
|
45
|
-
|
46
|
-
config.expect_with :rspec do |config|
|
47
|
-
config.syntax = :expect
|
48
|
-
end
|
49
|
-
|
50
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
51
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
52
|
-
|
53
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
54
|
-
# examples within a transaction, remove the following line or assign false
|
55
|
-
# instead of true.
|
56
|
-
config.use_transactional_fixtures = true
|
57
|
-
|
58
|
-
# If true, the base class of anonymous controllers will be inferred
|
59
|
-
# automatically. This will be the default behavior in future versions of
|
60
|
-
# rspec-rails.
|
61
|
-
config.infer_base_class_for_anonymous_controllers = false
|
62
|
-
|
63
|
-
# Run specs in random order to surface order dependencies. If you find an
|
64
|
-
# order dependency and want to debug it, you can fix the order by providing
|
65
|
-
# the seed, which is printed after each run.
|
66
|
-
# --seed 1234
|
67
|
-
config.order = "random"
|
68
|
-
end
|
data/spec/support/vcr/cassettes/Kuva_ApplicationController/configuring_Kuva/sets_the_API_key.yml
DELETED
@@ -1,160 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://api.flickr.com/services/rest/
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: method=flickr.reflection.getMethods&format=json&nojsoncallback=1
|
9
|
-
headers:
|
10
|
-
Accept-Encoding:
|
11
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
-
Accept:
|
13
|
-
- '*/*'
|
14
|
-
User-Agent:
|
15
|
-
- FlickRaw/0.9.8
|
16
|
-
Authorization:
|
17
|
-
- OAuth realm="https://api.flickr.com/services/rest/", oauth_consumer_key="<KUVA_API_KEY>",
|
18
|
-
oauth_nonce="z0BwXVs9qegd7x1tGIOekNSTVqcpnU7Z9n571%2FSFKpw%3D", oauth_signature="<KUVA_SHARED_SECRET>%26",
|
19
|
-
oauth_signature_method="PLAINTEXT", oauth_timestamp="1397347652", oauth_token="",
|
20
|
-
oauth_version="1.0"
|
21
|
-
Content-Type:
|
22
|
-
- application/x-www-form-urlencoded
|
23
|
-
response:
|
24
|
-
status:
|
25
|
-
code: 200
|
26
|
-
message: OK
|
27
|
-
headers:
|
28
|
-
Date:
|
29
|
-
- Sun, 13 Apr 2014 00:07:32 GMT
|
30
|
-
P3p:
|
31
|
-
- policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV
|
32
|
-
TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY
|
33
|
-
ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
|
34
|
-
Cache-Control:
|
35
|
-
- private
|
36
|
-
X-Served-By:
|
37
|
-
- www81.flickr.bf1.yahoo.com
|
38
|
-
Vary:
|
39
|
-
- Accept-Encoding
|
40
|
-
Content-Length:
|
41
|
-
- '1432'
|
42
|
-
Content-Type:
|
43
|
-
- application/json
|
44
|
-
Age:
|
45
|
-
- '3'
|
46
|
-
Via:
|
47
|
-
- http/1.1 fts120.flickr.bf1.yahoo.com (ApacheTrafficServer/4.0.2 [cMsSf ]),
|
48
|
-
http/1.1 r18.ycpi.ir2.yahoo.net (ApacheTrafficServer/4.0.2 [cMsSf ])
|
49
|
-
Server:
|
50
|
-
- ATS
|
51
|
-
Connection:
|
52
|
-
- keep-alive
|
53
|
-
body:
|
54
|
-
encoding: UTF-8
|
55
|
-
string: '{"methods":{"method":[{"_content":"flickr.activity.userComments"},
|
56
|
-
{"_content":"flickr.activity.userPhotos"}, {"_content":"flickr.auth.checkToken"},
|
57
|
-
{"_content":"flickr.auth.getFrob"}, {"_content":"flickr.auth.getFullToken"},
|
58
|
-
{"_content":"flickr.auth.getToken"}, {"_content":"flickr.auth.oauth.checkToken"},
|
59
|
-
{"_content":"flickr.auth.oauth.getAccessToken"}, {"_content":"flickr.blogs.getList"},
|
60
|
-
{"_content":"flickr.blogs.getServices"}, {"_content":"flickr.blogs.postPhoto"},
|
61
|
-
{"_content":"flickr.cameras.getBrandModels"}, {"_content":"flickr.cameras.getBrands"},
|
62
|
-
{"_content":"flickr.collections.getInfo"}, {"_content":"flickr.collections.getTree"},
|
63
|
-
{"_content":"flickr.commons.getInstitutions"}, {"_content":"flickr.contacts.getList"},
|
64
|
-
{"_content":"flickr.contacts.getListRecentlyUploaded"}, {"_content":"flickr.contacts.getPublicList"},
|
65
|
-
{"_content":"flickr.contacts.getTaggingSuggestions"}, {"_content":"flickr.favorites.add"},
|
66
|
-
{"_content":"flickr.favorites.getContext"}, {"_content":"flickr.favorites.getList"},
|
67
|
-
{"_content":"flickr.favorites.getPublicList"}, {"_content":"flickr.favorites.remove"},
|
68
|
-
{"_content":"flickr.galleries.addPhoto"}, {"_content":"flickr.galleries.create"},
|
69
|
-
{"_content":"flickr.galleries.editMeta"}, {"_content":"flickr.galleries.editPhoto"},
|
70
|
-
{"_content":"flickr.galleries.editPhotos"}, {"_content":"flickr.galleries.getInfo"},
|
71
|
-
{"_content":"flickr.galleries.getList"}, {"_content":"flickr.galleries.getListForPhoto"},
|
72
|
-
{"_content":"flickr.galleries.getPhotos"}, {"_content":"flickr.groups.browse"},
|
73
|
-
{"_content":"flickr.groups.discuss.replies.add"}, {"_content":"flickr.groups.discuss.replies.delete"},
|
74
|
-
{"_content":"flickr.groups.discuss.replies.edit"}, {"_content":"flickr.groups.discuss.replies.getInfo"},
|
75
|
-
{"_content":"flickr.groups.discuss.replies.getList"}, {"_content":"flickr.groups.discuss.topics.add"},
|
76
|
-
{"_content":"flickr.groups.discuss.topics.getInfo"}, {"_content":"flickr.groups.discuss.topics.getList"},
|
77
|
-
{"_content":"flickr.groups.getInfo"}, {"_content":"flickr.groups.join"}, {"_content":"flickr.groups.joinRequest"},
|
78
|
-
{"_content":"flickr.groups.leave"}, {"_content":"flickr.groups.members.getList"},
|
79
|
-
{"_content":"flickr.groups.pools.add"}, {"_content":"flickr.groups.pools.getContext"},
|
80
|
-
{"_content":"flickr.groups.pools.getGroups"}, {"_content":"flickr.groups.pools.getPhotos"},
|
81
|
-
{"_content":"flickr.groups.pools.remove"}, {"_content":"flickr.groups.search"},
|
82
|
-
{"_content":"flickr.interestingness.getList"}, {"_content":"flickr.machinetags.getNamespaces"},
|
83
|
-
{"_content":"flickr.machinetags.getPairs"}, {"_content":"flickr.machinetags.getPredicates"},
|
84
|
-
{"_content":"flickr.machinetags.getRecentValues"}, {"_content":"flickr.machinetags.getValues"},
|
85
|
-
{"_content":"flickr.panda.getList"}, {"_content":"flickr.panda.getPhotos"},
|
86
|
-
{"_content":"flickr.people.findByEmail"}, {"_content":"flickr.people.findByUsername"},
|
87
|
-
{"_content":"flickr.people.getGroups"}, {"_content":"flickr.people.getInfo"},
|
88
|
-
{"_content":"flickr.people.getLimits"}, {"_content":"flickr.people.getPhotos"},
|
89
|
-
{"_content":"flickr.people.getPhotosOf"}, {"_content":"flickr.people.getPublicGroups"},
|
90
|
-
{"_content":"flickr.people.getPublicPhotos"}, {"_content":"flickr.people.getUploadStatus"},
|
91
|
-
{"_content":"flickr.photos.addTags"}, {"_content":"flickr.photos.comments.addComment"},
|
92
|
-
{"_content":"flickr.photos.comments.deleteComment"}, {"_content":"flickr.photos.comments.editComment"},
|
93
|
-
{"_content":"flickr.photos.comments.getList"}, {"_content":"flickr.photos.comments.getRecentForContacts"},
|
94
|
-
{"_content":"flickr.photos.delete"}, {"_content":"flickr.photos.geo.batchCorrectLocation"},
|
95
|
-
{"_content":"flickr.photos.geo.correctLocation"}, {"_content":"flickr.photos.geo.getLocation"},
|
96
|
-
{"_content":"flickr.photos.geo.getPerms"}, {"_content":"flickr.photos.geo.photosForLocation"},
|
97
|
-
{"_content":"flickr.photos.geo.removeLocation"}, {"_content":"flickr.photos.geo.setContext"},
|
98
|
-
{"_content":"flickr.photos.geo.setLocation"}, {"_content":"flickr.photos.geo.setPerms"},
|
99
|
-
{"_content":"flickr.photos.getAllContexts"}, {"_content":"flickr.photos.getContactsPhotos"},
|
100
|
-
{"_content":"flickr.photos.getContactsPublicPhotos"}, {"_content":"flickr.photos.getContext"},
|
101
|
-
{"_content":"flickr.photos.getCounts"}, {"_content":"flickr.photos.getExif"},
|
102
|
-
{"_content":"flickr.photos.getFavorites"}, {"_content":"flickr.photos.getInfo"},
|
103
|
-
{"_content":"flickr.photos.getNotInSet"}, {"_content":"flickr.photos.getPerms"},
|
104
|
-
{"_content":"flickr.photos.getRecent"}, {"_content":"flickr.photos.getSizes"},
|
105
|
-
{"_content":"flickr.photos.getUntagged"}, {"_content":"flickr.photos.getWithGeoData"},
|
106
|
-
{"_content":"flickr.photos.getWithoutGeoData"}, {"_content":"flickr.photos.licenses.getInfo"},
|
107
|
-
{"_content":"flickr.photos.licenses.setLicense"}, {"_content":"flickr.photos.notes.add"},
|
108
|
-
{"_content":"flickr.photos.notes.delete"}, {"_content":"flickr.photos.notes.edit"},
|
109
|
-
{"_content":"flickr.photos.people.add"}, {"_content":"flickr.photos.people.delete"},
|
110
|
-
{"_content":"flickr.photos.people.deleteCoords"}, {"_content":"flickr.photos.people.editCoords"},
|
111
|
-
{"_content":"flickr.photos.people.getList"}, {"_content":"flickr.photos.recentlyUpdated"},
|
112
|
-
{"_content":"flickr.photos.removeTag"}, {"_content":"flickr.photos.search"},
|
113
|
-
{"_content":"flickr.photos.setContentType"}, {"_content":"flickr.photos.setDates"},
|
114
|
-
{"_content":"flickr.photos.setMeta"}, {"_content":"flickr.photos.setPerms"},
|
115
|
-
{"_content":"flickr.photos.setSafetyLevel"}, {"_content":"flickr.photos.setTags"},
|
116
|
-
{"_content":"flickr.photos.suggestions.approveSuggestion"}, {"_content":"flickr.photos.suggestions.getList"},
|
117
|
-
{"_content":"flickr.photos.suggestions.rejectSuggestion"}, {"_content":"flickr.photos.suggestions.removeSuggestion"},
|
118
|
-
{"_content":"flickr.photos.suggestions.suggestLocation"}, {"_content":"flickr.photos.transform.rotate"},
|
119
|
-
{"_content":"flickr.photos.upload.checkTickets"}, {"_content":"flickr.photosets.addPhoto"},
|
120
|
-
{"_content":"flickr.photosets.comments.addComment"}, {"_content":"flickr.photosets.comments.deleteComment"},
|
121
|
-
{"_content":"flickr.photosets.comments.editComment"}, {"_content":"flickr.photosets.comments.getList"},
|
122
|
-
{"_content":"flickr.photosets.create"}, {"_content":"flickr.photosets.delete"},
|
123
|
-
{"_content":"flickr.photosets.editMeta"}, {"_content":"flickr.photosets.editPhotos"},
|
124
|
-
{"_content":"flickr.photosets.getContext"}, {"_content":"flickr.photosets.getInfo"},
|
125
|
-
{"_content":"flickr.photosets.getList"}, {"_content":"flickr.photosets.getPhotos"},
|
126
|
-
{"_content":"flickr.photosets.orderSets"}, {"_content":"flickr.photosets.removePhoto"},
|
127
|
-
{"_content":"flickr.photosets.removePhotos"}, {"_content":"flickr.photosets.reorderPhotos"},
|
128
|
-
{"_content":"flickr.photosets.setPrimaryPhoto"}, {"_content":"flickr.places.find"},
|
129
|
-
{"_content":"flickr.places.findByLatLon"}, {"_content":"flickr.places.getChildrenWithPhotosPublic"},
|
130
|
-
{"_content":"flickr.places.getInfo"}, {"_content":"flickr.places.getInfoByUrl"},
|
131
|
-
{"_content":"flickr.places.getPlaceTypes"}, {"_content":"flickr.places.getShapeHistory"},
|
132
|
-
{"_content":"flickr.places.getTopPlacesList"}, {"_content":"flickr.places.placesForBoundingBox"},
|
133
|
-
{"_content":"flickr.places.placesForContacts"}, {"_content":"flickr.places.placesForTags"},
|
134
|
-
{"_content":"flickr.places.placesForUser"}, {"_content":"flickr.places.resolvePlaceId"},
|
135
|
-
{"_content":"flickr.places.resolvePlaceURL"}, {"_content":"flickr.places.tagsForPlace"},
|
136
|
-
{"_content":"flickr.prefs.getContentType"}, {"_content":"flickr.prefs.getGeoPerms"},
|
137
|
-
{"_content":"flickr.prefs.getHidden"}, {"_content":"flickr.prefs.getPrivacy"},
|
138
|
-
{"_content":"flickr.prefs.getSafetyLevel"}, {"_content":"flickr.push.getSubscriptions"},
|
139
|
-
{"_content":"flickr.push.getTopics"}, {"_content":"flickr.push.subscribe"},
|
140
|
-
{"_content":"flickr.push.unsubscribe"}, {"_content":"flickr.reflection.getMethodInfo"},
|
141
|
-
{"_content":"flickr.reflection.getMethods"}, {"_content":"flickr.stats.getCollectionDomains"},
|
142
|
-
{"_content":"flickr.stats.getCollectionReferrers"}, {"_content":"flickr.stats.getCollectionStats"},
|
143
|
-
{"_content":"flickr.stats.getCSVFiles"}, {"_content":"flickr.stats.getPhotoDomains"},
|
144
|
-
{"_content":"flickr.stats.getPhotoReferrers"}, {"_content":"flickr.stats.getPhotosetDomains"},
|
145
|
-
{"_content":"flickr.stats.getPhotosetReferrers"}, {"_content":"flickr.stats.getPhotosetStats"},
|
146
|
-
{"_content":"flickr.stats.getPhotoStats"}, {"_content":"flickr.stats.getPhotostreamDomains"},
|
147
|
-
{"_content":"flickr.stats.getPhotostreamReferrers"}, {"_content":"flickr.stats.getPhotostreamStats"},
|
148
|
-
{"_content":"flickr.stats.getPopularPhotos"}, {"_content":"flickr.stats.getTotalViews"},
|
149
|
-
{"_content":"flickr.tags.getClusterPhotos"}, {"_content":"flickr.tags.getClusters"},
|
150
|
-
{"_content":"flickr.tags.getHotList"}, {"_content":"flickr.tags.getListPhoto"},
|
151
|
-
{"_content":"flickr.tags.getListUser"}, {"_content":"flickr.tags.getListUserPopular"},
|
152
|
-
{"_content":"flickr.tags.getListUserRaw"}, {"_content":"flickr.tags.getMostFrequentlyUsed"},
|
153
|
-
{"_content":"flickr.tags.getRelated"}, {"_content":"flickr.test.echo"}, {"_content":"flickr.test.login"},
|
154
|
-
{"_content":"flickr.test.null"}, {"_content":"flickr.urls.getGroup"}, {"_content":"flickr.urls.getUserPhotos"},
|
155
|
-
{"_content":"flickr.urls.getUserProfile"}, {"_content":"flickr.urls.lookupGallery"},
|
156
|
-
{"_content":"flickr.urls.lookupGroup"}, {"_content":"flickr.urls.lookupUser"}]},
|
157
|
-
"stat":"ok"}'
|
158
|
-
http_version:
|
159
|
-
recorded_at: Sun, 13 Apr 2014 00:07:33 GMT
|
160
|
-
recorded_with: VCR 2.9.0
|