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
data/spec/dummy/public/422.html
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/422.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>The change you wanted was rejected.</h1>
|
54
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
-
</div>
|
56
|
-
<p>If you are the application owner check the logs for more information.</p>
|
57
|
-
</body>
|
58
|
-
</html>
|
data/spec/dummy/public/500.html
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style>
|
6
|
-
body {
|
7
|
-
background-color: #EFEFEF;
|
8
|
-
color: #2E2F30;
|
9
|
-
text-align: center;
|
10
|
-
font-family: arial, sans-serif;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.dialog {
|
14
|
-
width: 25em;
|
15
|
-
margin: 4em auto 0 auto;
|
16
|
-
border: 1px solid #CCC;
|
17
|
-
border-right-color: #999;
|
18
|
-
border-left-color: #999;
|
19
|
-
border-bottom-color: #BBB;
|
20
|
-
border-top: #B00100 solid 4px;
|
21
|
-
border-top-left-radius: 9px;
|
22
|
-
border-top-right-radius: 9px;
|
23
|
-
background-color: white;
|
24
|
-
padding: 7px 4em 0 4em;
|
25
|
-
}
|
26
|
-
|
27
|
-
h1 {
|
28
|
-
font-size: 100%;
|
29
|
-
color: #730E15;
|
30
|
-
line-height: 1.5em;
|
31
|
-
}
|
32
|
-
|
33
|
-
body > p {
|
34
|
-
width: 33em;
|
35
|
-
margin: 0 auto 1em;
|
36
|
-
padding: 1em 0;
|
37
|
-
background-color: #F7F7F7;
|
38
|
-
border: 1px solid #CCC;
|
39
|
-
border-right-color: #999;
|
40
|
-
border-bottom-color: #999;
|
41
|
-
border-bottom-left-radius: 4px;
|
42
|
-
border-bottom-right-radius: 4px;
|
43
|
-
border-top-color: #DADADA;
|
44
|
-
color: #666;
|
45
|
-
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
-
}
|
47
|
-
</style>
|
48
|
-
</head>
|
49
|
-
|
50
|
-
<body>
|
51
|
-
<!-- This file lives in public/500.html -->
|
52
|
-
<div class="dialog">
|
53
|
-
<h1>We're sorry, but something went wrong.</h1>
|
54
|
-
</div>
|
55
|
-
<p>If you are the application owner check the logs for more information.</p>
|
56
|
-
</body>
|
57
|
-
</html>
|
File without changes
|
data/spec/features/photo_spec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
feature "photo", :vcr do
|
4
|
-
|
5
|
-
let(:photoset_id) { "72157632367381040" }
|
6
|
-
let(:photo_id) { "8318972536" }
|
7
|
-
|
8
|
-
background { visit kuva.set_photo_path(set_id: photoset_id, id: photo_id) }
|
9
|
-
|
10
|
-
scenario "viewing the first photo of the photoset" do
|
11
|
-
within "ul.breadcrumbs" do
|
12
|
-
expect(page).to have_selector "li", text: "Photosets"
|
13
|
-
expect(page).to have_selector "li", text: "Paris"
|
14
|
-
end
|
15
|
-
|
16
|
-
expect(page).to have_selector "h1", text: "Top of the Eiffel Tower"
|
17
|
-
expect(page).to have_selector "p", text: "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."
|
18
|
-
expect(page).to have_selector "img", count: 1
|
19
|
-
end
|
20
|
-
|
21
|
-
scenario "navigating back to the photoset page" do
|
22
|
-
expect(page).to have_selector "h1", text: "Top of the Eiffel Tower"
|
23
|
-
|
24
|
-
within "ul.breadcrumbs" do
|
25
|
-
expect(page).to have_selector "li", text: "Photosets"
|
26
|
-
expect(page).to have_selector "li", text: "Paris"
|
27
|
-
|
28
|
-
click_link "Paris"
|
29
|
-
end
|
30
|
-
|
31
|
-
expect(page).to have_selector "h1", text: "Paris"
|
32
|
-
expect(page).not_to have_selector "h1", text: "Top of the Eiffel Tower"
|
33
|
-
|
34
|
-
within "ul.breadcrumbs" do
|
35
|
-
expect(page).to have_selector "li", text: "Photosets"
|
36
|
-
expect(page).not_to have_selector "li", text: "Paris"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
feature "photoset collection", :vcr do
|
4
|
-
|
5
|
-
background { visit kuva.root_path }
|
6
|
-
|
7
|
-
scenario "viewing the photoset collection" do
|
8
|
-
expect(page).to have_selector "h1", text: "Photosets"
|
9
|
-
expect(page).to have_selector "ul.photosets li a img", count: 40
|
10
|
-
expect(page).not_to have_selector "ul.breadcrumbs"
|
11
|
-
end
|
12
|
-
|
13
|
-
scenario "navigating to the page with photos of the first photoset" do
|
14
|
-
expect(page).to have_selector "h1", text: "Photosets"
|
15
|
-
|
16
|
-
within "ul.photosets li:first" do
|
17
|
-
expect(page).to have_content "Paris"
|
18
|
-
find(:xpath, ".//a/img[@alt='Paris']/..").click
|
19
|
-
end
|
20
|
-
|
21
|
-
expect(page).to have_selector "h1", text: "Paris"
|
22
|
-
expect(page).to have_selector ".photos a img", count: 28
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
feature "photoset", :vcr do
|
4
|
-
|
5
|
-
let(:photoset_id) { "72157632367381040" }
|
6
|
-
|
7
|
-
background { visit kuva.set_path(id: photoset_id) }
|
8
|
-
|
9
|
-
scenario "viewing the first photoset of the photoset collection" do
|
10
|
-
within "ul.breadcrumbs" do
|
11
|
-
expect(page).to have_selector "li", text: "Photosets"
|
12
|
-
expect(page).not_to have_selector "li", text: "Paris"
|
13
|
-
end
|
14
|
-
|
15
|
-
expect(page).to have_selector "h1", text: "Paris"
|
16
|
-
expect(page).to have_selector ".photos a img", count: 28
|
17
|
-
end
|
18
|
-
|
19
|
-
scenario "navigating back to the photoset collection page" do
|
20
|
-
expect(page).to have_selector "h1", text: "Paris"
|
21
|
-
|
22
|
-
within "ul.breadcrumbs" do
|
23
|
-
click_link "Photosets"
|
24
|
-
end
|
25
|
-
|
26
|
-
expect(page).to have_selector "h1", text: "Photosets"
|
27
|
-
expect(page).not_to have_selector "h1", text: "Paris"
|
28
|
-
expect(page).not_to have_selector "ul.breadcrumbs"
|
29
|
-
end
|
30
|
-
|
31
|
-
scenario "navigating to the page with details of the first photo" do
|
32
|
-
expect(page).to have_selector "h1", text: "Paris"
|
33
|
-
|
34
|
-
within ".photos" do
|
35
|
-
expect(page).to have_link "Top of the Eiffel Tower"
|
36
|
-
click_link "Top of the Eiffel Tower"
|
37
|
-
end
|
38
|
-
|
39
|
-
expect(page).to have_selector "h1", text: "Top of the Eiffel Tower"
|
40
|
-
expect(page).not_to have_selector "h1", text: "Paris"
|
41
|
-
end
|
42
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "generators/kuva/assets_generator"
|
3
|
-
|
4
|
-
module Kuva
|
5
|
-
module Generators
|
6
|
-
describe AssetsGenerator do
|
7
|
-
destination File.expand_path("../../../../tmp", __FILE__)
|
8
|
-
|
9
|
-
let(:javascript) { file("app/assets/javascripts/kuva.js.coffee") }
|
10
|
-
let(:stylesheet) { file("app/assets/stylesheets/kuva.css.sass") }
|
11
|
-
|
12
|
-
before do
|
13
|
-
prepare_destination
|
14
|
-
run_generator
|
15
|
-
end
|
16
|
-
|
17
|
-
it "generates app/assets/javascript/kuva.js.coffee" do
|
18
|
-
expect(javascript).to exist
|
19
|
-
end
|
20
|
-
|
21
|
-
it "generates app/assets/stylesheets/kuva.css.sass" do
|
22
|
-
expect(stylesheet).to exist
|
23
|
-
end
|
24
|
-
|
25
|
-
after do
|
26
|
-
FileUtils.rm_rf File.expand_path("../../../../tmp", __FILE__)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "generators/kuva/install_generator"
|
3
|
-
|
4
|
-
module Kuva
|
5
|
-
module Generators
|
6
|
-
describe InstallGenerator do
|
7
|
-
destination File.expand_path("../../../../tmp", __FILE__)
|
8
|
-
|
9
|
-
let(:initializer) { file("config/initializers/kuva.rb") }
|
10
|
-
let(:locale) { file("config/locales/kuva.en.yml") }
|
11
|
-
let(:routes) { file("config/routes.rb") }
|
12
|
-
|
13
|
-
before do
|
14
|
-
prepare_destination
|
15
|
-
prepare_config_routes
|
16
|
-
end
|
17
|
-
|
18
|
-
it "generates config/initializers/kuva.rb" do
|
19
|
-
capture(:stdout) { generator.invoke :copy_initializer }
|
20
|
-
expect(initializer).to exist
|
21
|
-
end
|
22
|
-
|
23
|
-
it "generates config/locales/kuva.en.yml" do
|
24
|
-
capture(:stdout) { generator.invoke :copy_locale }
|
25
|
-
expect(locale).to exist
|
26
|
-
end
|
27
|
-
|
28
|
-
it "generates assets" do
|
29
|
-
expect_any_instance_of(described_class).to receive(:generate).with "kuva:assets"
|
30
|
-
generator.invoke :create_assets
|
31
|
-
end
|
32
|
-
|
33
|
-
context "mounting of the Kuva engine" do
|
34
|
-
context "when it has been mounted" do
|
35
|
-
before { described_class.any_instance.stub_chain(:original_routes, :include?).and_return true }
|
36
|
-
|
37
|
-
it "outputs a status message" do
|
38
|
-
expect_any_instance_of(described_class).to receive(:say_status).with "skip", "mounting of Kuva into config/routes.rb", :yellow
|
39
|
-
generator.invoke :mount_engine
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "when it hasn't been mounted" do
|
44
|
-
it "mounts the Kuva engine" do
|
45
|
-
capture(:stdout) { generator.invoke :mount_engine }
|
46
|
-
expect(routes).to contain 'mount Kuva::Engine => "/kuva"'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
after do
|
52
|
-
FileUtils.rm_rf destination_root
|
53
|
-
end
|
54
|
-
|
55
|
-
def prepare_config_routes
|
56
|
-
FileUtils.mkdir "#{destination_root}/config"
|
57
|
-
File.open("#{destination_root}/config/routes.rb", "w+") do |file|
|
58
|
-
file.write "Rails.application.routes.draw do\nend"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "generators/kuva/views_generator"
|
3
|
-
|
4
|
-
module Kuva
|
5
|
-
module Generators
|
6
|
-
describe ViewsGenerator do
|
7
|
-
destination File.expand_path("../../../../tmp", __FILE__)
|
8
|
-
|
9
|
-
let(:views_directory) { "app/views/kuva" }
|
10
|
-
|
11
|
-
let(:sets_index) { file("#{views_directory}/sets/index.html.haml") }
|
12
|
-
let(:sets_show) { file("#{views_directory}/sets/show.html.haml") }
|
13
|
-
let(:photos_show) { file("#{views_directory}/photos/show.html.haml") }
|
14
|
-
|
15
|
-
before do
|
16
|
-
prepare_destination
|
17
|
-
run_generator
|
18
|
-
end
|
19
|
-
|
20
|
-
it "generates the app/views/kuva/photos/show.html.haml view" do
|
21
|
-
expect(photos_show).to exist
|
22
|
-
end
|
23
|
-
|
24
|
-
it "generates the app/views/kuva/sets/index.html.haml view" do
|
25
|
-
expect(sets_index).to exist
|
26
|
-
end
|
27
|
-
|
28
|
-
it "generates the app/views/kuva/sets/show.html.haml view" do
|
29
|
-
expect(sets_show).to exist
|
30
|
-
end
|
31
|
-
|
32
|
-
after do
|
33
|
-
FileUtils.rm_rf File.expand_path("../../../../tmp", __FILE__)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Kuva::ApplicationHelper, :vcr do
|
4
|
-
|
5
|
-
describe "#breadcrumbs_for" do
|
6
|
-
let(:photoset_id) { "72157632367381040" }
|
7
|
-
let(:photoset) { Kuva::Elements::Photoset.find photoset_id }
|
8
|
-
|
9
|
-
subject { helper.breadcrumbs_for photoset }
|
10
|
-
|
11
|
-
context "when the current page is the set page" do
|
12
|
-
before { allow(helper).to receive(:photoset_page?).and_return true }
|
13
|
-
|
14
|
-
it "creates a breadcrumb without the set URL" do
|
15
|
-
expect(subject).to eq '<ul class="breadcrumbs"><li><a href="http://test.host/kuva/">Photosets</a></li></ul>'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context "when the current page is NOT the set page" do
|
20
|
-
it "creates a breadcrumb with the set URL" do
|
21
|
-
expect(subject).to eq '<ul class="breadcrumbs"><li><a href="http://test.host/kuva/">Photosets</a></li><li><a href="http://test.host/kuva/sets/72157632367381040">Paris</a></li></ul>'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
module Kuva
|
4
|
-
describe Authorizer do
|
5
|
-
|
6
|
-
context ".new" do
|
7
|
-
before do
|
8
|
-
allow(Kuva).to receive(:api_key).and_return "<api_key>"
|
9
|
-
allow(Kuva).to receive(:shared_secret).and_return "<shared_secret>"
|
10
|
-
end
|
11
|
-
|
12
|
-
it "configures the FlickRaw API key" do
|
13
|
-
described_class.new
|
14
|
-
expect(FlickRaw.api_key).to eq "<api_key>"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "configures the FlickRaw shared secret" do
|
18
|
-
described_class.new
|
19
|
-
expect(FlickRaw.shared_secret).to eq "<shared_secret>"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context ".authorize" do
|
24
|
-
it "authorizes" do
|
25
|
-
allow_any_instance_of(Authorizer).to receive :authorize
|
26
|
-
described_class.authorize
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "#authorize" do
|
31
|
-
before do
|
32
|
-
allow(STDIN).to receive(:gets).and_return "<authorization_code>"
|
33
|
-
end
|
34
|
-
|
35
|
-
let(:output) do
|
36
|
-
capture(:stdout) { subject.authorize }
|
37
|
-
end
|
38
|
-
|
39
|
-
context "with a valid authentication code" do
|
40
|
-
before do
|
41
|
-
allow(subject).to receive(:flickr).and_return double.as_null_object
|
42
|
-
end
|
43
|
-
|
44
|
-
it "outputs a notice about the authentication url" do
|
45
|
-
allow(subject).to receive(:authentication_url).and_return "<url>"
|
46
|
-
expect(output).to include "\nCopy the URL below and follow the steps on Flickr to authorize Kuva:\n<url>"
|
47
|
-
end
|
48
|
-
|
49
|
-
it "outputs a notice about the authentication code" do
|
50
|
-
expect(output).to include "\nOnce you've authorized Kuva, you'll receive a code (in the form of xxx-xxx-xxx) from Flickr. Copy and paste that code here and press <enter>:\n"
|
51
|
-
end
|
52
|
-
|
53
|
-
it "outputs a confirmation notice" do
|
54
|
-
allow(Kuva).to receive(:api_key).and_return "<api_key>"
|
55
|
-
allow(Kuva).to receive(:shared_secret).and_return "<shared_secret>"
|
56
|
-
subject.stub_chain(:flickr, :test, :login, :username).and_return "<username>"
|
57
|
-
subject.stub_chain(:flickr, :access_token).and_return "<access_token>"
|
58
|
-
subject.stub_chain(:flickr, :access_secret).and_return "<access_secret>"
|
59
|
-
|
60
|
-
expect(output).to include "\n<username>, you've successfully authorized Kuva with Flickr. As you can see we've received your username. Besides that we've got the following access token '<access_token>' and access secret '<access_secret>'. Both the API key, shared secret and the previously mentioned variables should be saved for later use. They're all listed below. Place them in `config/initializers/kuva.rb` and you're good to go.\n\n\tapi_key: <api_key>\n\tshared_secret: <shared_secret>\n\taccess_token: <access_token>\n\taccess_secret: <access_secret>\n\n"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
context "with an invalid authentication code" do
|
65
|
-
it "outputs an authentication error" do
|
66
|
-
expect(output).to include "Authentication with Flickr failed: token_rejected"
|
67
|
-
end
|
68
|
-
|
69
|
-
context "with an incorrect API key and shared secret" do
|
70
|
-
before do
|
71
|
-
allow(FlickRaw).to receive(:api_key).and_return "<api_key>"
|
72
|
-
allow(FlickRaw).to receive(:shared_secret).and_return "<shared_secret>"
|
73
|
-
end
|
74
|
-
|
75
|
-
it "raises a failed response error" do
|
76
|
-
expect { flickr.get_access_token("<api_key>", "<shared_secret>", "<authentication_code>") }.to raise_error FlickRaw::OAuthClient::FailedResponse
|
77
|
-
capture(:stdout) { subject.authorize }
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|