country_flags 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +41 -41
- data/.rspec +2 -2
- data/Gemfile +3 -3
- data/LICENSE +22 -22
- data/README.md +54 -54
- data/country_flags.gemspec +24 -24
- data/lib/country_flags.rb +3 -3
- data/lib/country_flags/engine.rb +5 -5
- data/lib/country_flags/helper.rb +37 -37
- data/lib/country_flags/railtie.rb +9 -8
- data/lib/country_flags/version.rb +3 -3
- data/project.sublime-project +13 -13
- data/spec/country_flags/helper_spec.rb +40 -40
- data/spec/spec_helper.rb +7 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af07152a616b6c0b3710d72307d05e16811458b9
|
4
|
+
data.tar.gz: a86758d6e20d2f8bc66f6e6a7a643be77f63f7f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61bbe897f04c7bcf32fb4cf582c1bfc578c49ee07a62612781bcb82aac1b2e2d62e30f9bf0c35829e92dcf380f37d11562152a07ca54983896ba492d539f1eba
|
7
|
+
data.tar.gz: dab050e5881b32933f2dd6f028f4b44083d9bd6fee2ebaf1a5044816fcb0985b31c794863929f218e906c85c94d81f7c7f5dbf83f4fdbef6252014077a9f1a1f
|
data/.gitignore
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
/.config
|
4
|
-
/coverage/
|
5
|
-
/InstalledFiles
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/test/tmp/
|
9
|
-
/test/version_tmp/
|
10
|
-
/tmp/
|
11
|
-
|
12
|
-
## Specific to RubyMotion:
|
13
|
-
.dat*
|
14
|
-
.repl_history
|
15
|
-
build/
|
16
|
-
|
17
|
-
## Documentation cache and generated files:
|
18
|
-
/.yardoc/
|
19
|
-
/_yardoc/
|
20
|
-
/doc/
|
21
|
-
/rdoc/
|
22
|
-
|
23
|
-
## Environment normalisation:
|
24
|
-
/.bundle/
|
25
|
-
/vendor/bundle
|
26
|
-
/lib/bundler/man/
|
27
|
-
|
28
|
-
# for a library or gem, you might want to ignore these files since the code is
|
29
|
-
# intended to run in multiple environments; otherwise, check them in:
|
30
|
-
Gemfile.lock
|
31
|
-
.ruby-version
|
32
|
-
.ruby-gemset
|
33
|
-
|
34
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
-
.rvmrc
|
36
|
-
|
37
|
-
# Sublime Text workspace
|
38
|
-
project.sublime-workspace
|
39
|
-
|
40
|
-
# vi(m) swap files
|
41
|
-
*.sw?
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/vendor/bundle
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
Gemfile.lock
|
31
|
+
.ruby-version
|
32
|
+
.ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
36
|
+
|
37
|
+
# Sublime Text workspace
|
38
|
+
project.sublime-workspace
|
39
|
+
|
40
|
+
# vi(m) swap files
|
41
|
+
*.sw?
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--color
|
2
|
-
--require spec_helper
|
1
|
+
--color
|
2
|
+
--require spec_helper
|
data/Gemfile
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
data/LICENSE
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2015 Alexander Lazarov
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
22
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Alexander Lazarov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
# Readme
|
2
|
-
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/country_flags.svg)](http://badge.fury.io/rb/country_flags)
|
4
|
-
|
5
|
-
Gemified collection of
|
6
|
-
[country flags](http://www.famfamfam.com/lab/icons/flags/).
|
7
|
-
|
8
|
-
## Usage
|
9
|
-
|
10
|
-
Add to your Gemfile:
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
gem 'country_flags'
|
14
|
-
```
|
15
|
-
|
16
|
-
Run:
|
17
|
-
|
18
|
-
```bash
|
19
|
-
bundle install
|
20
|
-
```
|
21
|
-
|
22
|
-
In views:
|
23
|
-
```ruby
|
24
|
-
|
25
|
-
# using helper
|
26
|
-
country_flag 'bg'
|
27
|
-
country_flag 'bg', format: 'gif'
|
28
|
-
|
29
|
-
image_tag country_flag_path 'bg'
|
30
|
-
image_tag country_flag_path 'bg', :gif
|
31
|
-
|
32
|
-
# gif version
|
33
|
-
image_tag 'country_flags/gif/bg.gif'
|
34
|
-
|
35
|
-
# png version
|
36
|
-
image_tag 'country_flags/png/bg.gif'
|
37
|
-
```
|
38
|
-
|
39
|
-
## Testing
|
40
|
-
|
41
|
-
Use `rspec` to run the tests.
|
42
|
-
|
43
|
-
```bash
|
44
|
-
bundle exec rspec
|
45
|
-
```
|
46
|
-
|
47
|
-
## Credit
|
48
|
-
|
49
|
-
Country flags are made by [famfamfam](http://www.famfamfam.com/).
|
50
|
-
|
51
|
-
## Contributing
|
52
|
-
|
53
|
-
Your contributions are welcome. Please fork the project, make a new branch and
|
54
|
-
send me a pull request.
|
1
|
+
# Readme
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/country_flags.svg)](http://badge.fury.io/rb/country_flags)
|
4
|
+
|
5
|
+
Gemified collection of
|
6
|
+
[country flags](http://www.famfamfam.com/lab/icons/flags/).
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
Add to your Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'country_flags'
|
14
|
+
```
|
15
|
+
|
16
|
+
Run:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
bundle install
|
20
|
+
```
|
21
|
+
|
22
|
+
In views:
|
23
|
+
```ruby
|
24
|
+
|
25
|
+
# using helper
|
26
|
+
country_flag 'bg'
|
27
|
+
country_flag 'bg', format: 'gif'
|
28
|
+
|
29
|
+
image_tag country_flag_path 'bg'
|
30
|
+
image_tag country_flag_path 'bg', :gif
|
31
|
+
|
32
|
+
# gif version
|
33
|
+
image_tag 'country_flags/gif/bg.gif'
|
34
|
+
|
35
|
+
# png version
|
36
|
+
image_tag 'country_flags/png/bg.gif'
|
37
|
+
```
|
38
|
+
|
39
|
+
## Testing
|
40
|
+
|
41
|
+
Use `rspec` to run the tests.
|
42
|
+
|
43
|
+
```bash
|
44
|
+
bundle exec rspec
|
45
|
+
```
|
46
|
+
|
47
|
+
## Credit
|
48
|
+
|
49
|
+
Country flags are made by [famfamfam](http://www.famfamfam.com/).
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
Your contributions are welcome. Please fork the project, make a new branch and
|
54
|
+
send me a pull request.
|
data/country_flags.gemspec
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
$:.push File.expand_path('../lib', __FILE__)
|
2
|
-
require 'country_flags/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = 'country_flags'
|
6
|
-
s.version = CountryFlags::VERSION
|
7
|
-
s.authors = ['Alexander Lazarov']
|
8
|
-
s.description = 'Gemified collection of country flags. See homepage for details: https://github.com/alexander-lazarov/country_flags'
|
9
|
-
s.email = 'alexander.lazaroff@gmail.com'
|
10
|
-
s.extra_rdoc_files = [ 'LICENSE' ]
|
11
|
-
s.files = `git ls-files`.split("\n")
|
12
|
-
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
13
|
-
|
14
|
-
s.homepage = 'https://github.com/alexander-lazarov/country_flags'
|
15
|
-
s.require_paths = %w(lib)
|
16
|
-
s.summary = 'Gemified collection of country flags.'
|
17
|
-
|
18
|
-
s.license = 'MIT'
|
19
|
-
|
20
|
-
s.add_development_dependency('rspec', '>= 2.11')
|
21
|
-
s.add_dependency 'railties', '>= 3.1'
|
22
|
-
s.add_dependency 'actionview', '>= 3.1'
|
23
|
-
s.add_dependency 'normalize_country', '>= 0.1'
|
24
|
-
end
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'country_flags/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'country_flags'
|
6
|
+
s.version = CountryFlags::VERSION
|
7
|
+
s.authors = ['Alexander Lazarov']
|
8
|
+
s.description = 'Gemified collection of country flags. See homepage for details: https://github.com/alexander-lazarov/country_flags'
|
9
|
+
s.email = 'alexander.lazaroff@gmail.com'
|
10
|
+
s.extra_rdoc_files = [ 'LICENSE' ]
|
11
|
+
s.files = `git ls-files`.split("\n")
|
12
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
13
|
+
|
14
|
+
s.homepage = 'https://github.com/alexander-lazarov/country_flags'
|
15
|
+
s.require_paths = %w(lib)
|
16
|
+
s.summary = 'Gemified collection of country flags.'
|
17
|
+
|
18
|
+
s.license = 'MIT'
|
19
|
+
|
20
|
+
s.add_development_dependency('rspec', '>= 2.11')
|
21
|
+
s.add_dependency 'railties', '>= 3.1'
|
22
|
+
s.add_dependency 'actionview', '>= 3.1'
|
23
|
+
s.add_dependency 'normalize_country', '>= 0.1'
|
24
|
+
end
|
data/lib/country_flags.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'country_flags/version'
|
2
|
-
require 'country_flags/engine'
|
3
|
-
require 'country_flags/railtie'
|
1
|
+
require 'country_flags/version'
|
2
|
+
require 'country_flags/engine'
|
3
|
+
require 'country_flags/railtie'
|
4
4
|
require 'country_flags/helper' if defined? Rails
|
data/lib/country_flags/engine.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'rails'
|
2
|
-
|
3
|
-
module CountryFlags
|
4
|
-
class Engine < ::Rails::Engine
|
5
|
-
end
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module CountryFlags
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
end
|
6
6
|
end
|
data/lib/country_flags/helper.rb
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
require 'action_view'
|
2
|
-
|
3
|
-
require 'normalize_country'
|
4
|
-
|
5
|
-
module CountryFlags
|
6
|
-
module Helper
|
7
|
-
|
8
|
-
include ActionView::Helpers::AssetUrlHelper
|
9
|
-
include ActionView::Helpers::AssetTagHelper
|
10
|
-
|
11
|
-
# returns path to flag image
|
12
|
-
# use ISO-3166 Alpha 2 country codes
|
13
|
-
# format can be :png or :gif
|
14
|
-
def country_flag_path( country_code, format = :png )
|
15
|
-
unless [:png, :gif].include?(format)
|
16
|
-
raise(ArgumentError, 'format must be :png or :gif')
|
17
|
-
end
|
18
|
-
|
19
|
-
return '' unless country_code && !country_code.empty?
|
20
|
-
|
21
|
-
path = "country_flags/#{format}/#{country_code.downcase}.#{format}"
|
22
|
-
image_path path
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
def country_flag( country_code, options = {} )
|
27
|
-
options = {format: :png}.merge(options)
|
28
|
-
|
29
|
-
country_name = NormalizeCountry( country_code, to: :short )
|
30
|
-
|
31
|
-
return '' unless country_name
|
32
|
-
|
33
|
-
image_tag country_flag_path(country_code, options[:format]),
|
34
|
-
alt: country_name, title: country_name
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
1
|
+
require 'action_view'
|
2
|
+
|
3
|
+
require 'normalize_country'
|
4
|
+
|
5
|
+
module CountryFlags
|
6
|
+
module Helper
|
7
|
+
|
8
|
+
include ActionView::Helpers::AssetUrlHelper
|
9
|
+
include ActionView::Helpers::AssetTagHelper
|
10
|
+
|
11
|
+
# returns path to flag image
|
12
|
+
# use ISO-3166 Alpha 2 country codes
|
13
|
+
# format can be :png or :gif
|
14
|
+
def country_flag_path( country_code, format = :png )
|
15
|
+
unless [:png, :gif].include?(format)
|
16
|
+
raise(ArgumentError, 'format must be :png or :gif')
|
17
|
+
end
|
18
|
+
|
19
|
+
return '' unless country_code && !country_code.empty?
|
20
|
+
|
21
|
+
path = "country_flags/#{format}/#{country_code.downcase}.#{format}"
|
22
|
+
image_path path
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def country_flag( country_code, options = {} )
|
27
|
+
options = {format: :png}.merge(options)
|
28
|
+
|
29
|
+
country_name = NormalizeCountry( country_code, to: :short )
|
30
|
+
|
31
|
+
return '' unless country_name
|
32
|
+
|
33
|
+
image_tag country_flag_path(country_code, options[:format]),
|
34
|
+
alt: country_name, title: country_name
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,9 +1,10 @@
|
|
1
|
-
require 'rails'
|
2
|
-
|
3
|
-
module CountryFlags
|
4
|
-
class Railtie < ::Rails::Railtie
|
5
|
-
initializer 'country_flags.view_helpers' do
|
6
|
-
ActionView::Base.send :include, Helper
|
7
|
-
|
8
|
-
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
module CountryFlags
|
4
|
+
class Railtie < ::Rails::Railtie
|
5
|
+
initializer 'country_flags.view_helpers' do
|
6
|
+
ActionView::Base.send :include, Helper
|
7
|
+
Rails.application.config.assets.precompile += %w(country_flags/png/* country_flags/gif/*)
|
8
|
+
end
|
9
|
+
end
|
9
10
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module CountryFlags
|
2
|
-
VERSION = '0.1.
|
3
|
-
end
|
1
|
+
module CountryFlags
|
2
|
+
VERSION = '0.1.4'
|
3
|
+
end
|
data/project.sublime-project
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
{
|
2
|
-
"folders":
|
3
|
-
[
|
4
|
-
{
|
5
|
-
"path": "."
|
6
|
-
}
|
7
|
-
],
|
8
|
-
"settings":
|
9
|
-
{
|
10
|
-
"convert_tab_to_spaces": true,
|
11
|
-
"tab_size": 2
|
12
|
-
}
|
13
|
-
}
|
1
|
+
{
|
2
|
+
"folders":
|
3
|
+
[
|
4
|
+
{
|
5
|
+
"path": "."
|
6
|
+
}
|
7
|
+
],
|
8
|
+
"settings":
|
9
|
+
{
|
10
|
+
"convert_tab_to_spaces": true,
|
11
|
+
"tab_size": 2
|
12
|
+
}
|
13
|
+
}
|
@@ -1,40 +1,40 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe CountryFlags::Helper do
|
4
|
-
|
5
|
-
include CountryFlags::Helper
|
6
|
-
|
7
|
-
describe '#country_flag_path' do
|
8
|
-
it 'throws exception if wrong format given' do
|
9
|
-
expect { country_flag_path('bg', :tiff) }.to raise_error(ArgumentError)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'does not throw exception if format given in string' do
|
13
|
-
expect { country_flag_path('bg', 'gif') }.to raise_error(ArgumentError)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns image path' do
|
17
|
-
expect(country_flag_path('bg', :png)).to be_a(String)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'returns empty string if no country path given' do
|
21
|
-
expect(country_flag_path(nil)).to eq('')
|
22
|
-
expect(country_flag_path('')).to eq('')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#country_flag' do
|
27
|
-
it 'returns image tag' do
|
28
|
-
expect(country_flag('bg')).to be_a(String)
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'throws exception if wrong format given' do
|
32
|
-
expect { country_flag('bg', format: :tiff) }.to raise_error(ArgumentError)
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'returns empty string if no coutry given' do
|
36
|
-
expect(country_flag(nil)).to eq('')
|
37
|
-
expect(country_flag('')).to eq('')
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CountryFlags::Helper do
|
4
|
+
|
5
|
+
include CountryFlags::Helper
|
6
|
+
|
7
|
+
describe '#country_flag_path' do
|
8
|
+
it 'throws exception if wrong format given' do
|
9
|
+
expect { country_flag_path('bg', :tiff) }.to raise_error(ArgumentError)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'does not throw exception if format given in string' do
|
13
|
+
expect { country_flag_path('bg', 'gif') }.to raise_error(ArgumentError)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'returns image path' do
|
17
|
+
expect(country_flag_path('bg', :png)).to be_a(String)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'returns empty string if no country path given' do
|
21
|
+
expect(country_flag_path(nil)).to eq('')
|
22
|
+
expect(country_flag_path('')).to eq('')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#country_flag' do
|
27
|
+
it 'returns image tag' do
|
28
|
+
expect(country_flag('bg')).to be_a(String)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'throws exception if wrong format given' do
|
32
|
+
expect { country_flag('bg', format: :tiff) }.to raise_error(ArgumentError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns empty string if no coutry given' do
|
36
|
+
expect(country_flag(nil)).to eq('')
|
37
|
+
expect(country_flag('')).to eq('')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rspec'
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
5
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
|
-
|
7
|
-
require 'country_flags'
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
5
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'country_flags'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: country_flags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Lazarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -601,7 +601,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
601
601
|
version: '0'
|
602
602
|
requirements: []
|
603
603
|
rubyforge_project:
|
604
|
-
rubygems_version: 2.
|
604
|
+
rubygems_version: 2.2.5
|
605
605
|
signing_key:
|
606
606
|
specification_version: 4
|
607
607
|
summary: Gemified collection of country flags.
|