weather-seven-rails 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ require 'test_helper'
2
+
3
+ class WeatherSeven::Rails::IconHelperTest < ActionView::TestCase
4
+
5
+ test "#w7_icon with no args should render an wind icon" do
6
+ assert_icon i("pe-7w-wind")
7
+ end
8
+
9
+ test "#w7_icon should render different individual icons" do
10
+ assert_icon i("pe-7w-wind"), "wind"
11
+ assert_icon i("pe-7w-sun"), "sun"
12
+ assert_icon i("pe-7w-snow-moon"), "snow-moon"
13
+ end
14
+
15
+ test "#w7_icon should incorporate additional class styles" do
16
+ assert_icon i("pe-7w-wind pull-right"), "wind", :class => "pull-right"
17
+ assert_icon i("pe-7w-wind pull-right success"), "wind", :class => "pull-right success"
18
+ end
19
+
20
+ test "#w7_icon should incorporate a text suffix" do
21
+ assert_icon "#{i("pe-7w-sun")} Take a photo", "sun", :text => "Take a photo"
22
+ end
23
+
24
+ test "#w7_icon should html escape text" do
25
+ assert_icon "#{i("pe-7w-sun")} &lt;script&gt;&lt;/script&gt;", "sun", :text => "<script></script>"
26
+ end
27
+
28
+ test "#w7_icon should not html escape safe text" do
29
+ assert_icon "#{i("pe-7w-sun")} <script></script>", "sun", :text => "<script></script>".html_safe
30
+ end
31
+
32
+ test "#w7_icon should pull it all together" do
33
+ assert_icon "#{i("pe-7w-sun pull-right")} Take a photo", "sun", :text => "Take a photo", :class => "pull-right"
34
+ end
35
+
36
+ test "#w7_icon should pass all other options through" do
37
+ assert_icon %(<i class="pe-7w-sunset" data-id="123"></i>), "sunset", :data => { :id => 123 }
38
+ end
39
+
40
+ private
41
+
42
+ def assert_icon(expected, *args)
43
+ message = "`w7_icon(#{args.inspect[1...-1]})` should return `#{expected}`"
44
+ assert_dom_equal expected, w7_icon(*args), message
45
+ end
46
+
47
+ def i(classes)
48
+ %(<i class="#{classes}"></i>)
49
+ end
50
+ end
@@ -0,0 +1,7 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,67 @@
1
+ require 'test_helper'
2
+
3
+ class WeatherSevenRailsTest < ActionDispatch::IntegrationTest
4
+ teardown { clean_sprockets_cache }
5
+
6
+ test "engine is loaded" do
7
+ assert_equal ::Rails::Engine, WeatherSeven::Rails::Engine.superclass
8
+ end
9
+
10
+ test "fonts are served" do
11
+ get "/assets/Pe-icon-7-weather.eot"
12
+ assert_response :success
13
+ get "/assets/Pe-icon-7-weather.woff"
14
+ assert_response :success
15
+ get "/assets/Pe-icon-7-weather.ttf"
16
+ assert_response :success
17
+ get "/assets/Pe-icon-7-weather.svg"
18
+ assert_response :success
19
+ end
20
+
21
+ test "stylesheets are served" do
22
+ get "/assets/weather-seven.css"
23
+ assert_weather_seven(response)
24
+ end
25
+
26
+ test "stylesheets contain asset pipeline references to fonts" do
27
+ get "/assets/weather-seven.css"
28
+ v = WeatherSeven::Rails::W7_VERSION
29
+ assert_match "/assets/Pe-icon-7-weather.eot?v=#{v}", response.body
30
+ assert_match "/assets/Pe-icon-7-weather.eot?#iefix&v=#{v}", response.body
31
+ assert_match "/assets/Pe-icon-7-weather.woff?v=#{v}", response.body
32
+ assert_match "/assets/Pe-icon-7-weather.ttf?v=#{v}", response.body
33
+ assert_match "/assets/Pe-icon-7-weather.svg?v=#{v}#Pe-icon-7-weather", response.body
34
+ end
35
+
36
+ test "stylesheet is available in a css sprockets require" do
37
+ get "/assets/sprockets-require.css"
38
+ assert_weather_seven(response)
39
+ end
40
+
41
+ test "stylesheet is available in a sass import" do
42
+ get "/assets/sass-import.css"
43
+ assert_weather_seven(response)
44
+ end
45
+
46
+ test "stylesheet is available in a scss import" do
47
+ get "/assets/scss-import.css"
48
+ assert_weather_seven(response)
49
+ end
50
+
51
+ test "helpers should be available in the view" do
52
+ get "/icons"
53
+ assert_response :success
54
+ assert_select "i.pe-7w-wind"
55
+ end
56
+
57
+ private
58
+
59
+ def clean_sprockets_cache
60
+ FileUtils.rm_rf File.expand_path("../dummy/tmp", __FILE__)
61
+ end
62
+
63
+ def assert_weather_seven(response)
64
+ assert_response :success
65
+ assert_match(/font-family:\s*'Pe-icon-7-weather';/, response.body)
66
+ end
67
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: weather-seven-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - bimovidia
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: activesupport
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: sass-rails
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: I like Weather 7 fonts. I like the asset pipeline. I like semantic versioning.
62
+ If you do too, you're welcome.
63
+ email:
64
+ - bimo.wijoyo@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - LICENSE
70
+ - README.md
71
+ - Rakefile
72
+ - app/assets/fonts/Pe-icon-7-weather.eot
73
+ - app/assets/fonts/Pe-icon-7-weather.svg
74
+ - app/assets/fonts/Pe-icon-7-weather.ttf
75
+ - app/assets/fonts/Pe-icon-7-weather.woff
76
+ - app/assets/stylesheets/weather-seven-helper.css
77
+ - app/assets/stylesheets/weather-seven.css.erb
78
+ - app/helpers/weather_seven/rails/icon_helper.rb
79
+ - lib/weather-seven-rails.rb
80
+ - lib/weather-seven-rails/engine.rb
81
+ - lib/weather-seven-rails/version.rb
82
+ - test/dummy/app/assets/stylesheets/sass-import.css.sass
83
+ - test/dummy/app/assets/stylesheets/scss-import.css.scss
84
+ - test/dummy/app/assets/stylesheets/sprockets-require.css
85
+ - test/dummy/app/controllers/pages_controller.rb
86
+ - test/dummy/app/views/pages/icons.html.erb
87
+ - test/dummy/config.ru
88
+ - test/dummy/config/application.rb
89
+ - test/dummy/config/boot.rb
90
+ - test/dummy/config/environment.rb
91
+ - test/dummy/config/initializers/secret_token.rb
92
+ - test/dummy/config/routes.rb
93
+ - test/dummy/log/test.log
94
+ - test/icon_helper_test.rb
95
+ - test/test_helper.rb
96
+ - test/weather_seven_rails_test.rb
97
+ homepage: https://github.com/bimovidia/weather-seven-rails
98
+ licenses:
99
+ - MIT
100
+ - SIL Open Font License
101
+ metadata: {}
102
+ post_install_message:
103
+ rdoc_options: []
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.9.3
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ requirements: []
117
+ rubyforge_project:
118
+ rubygems_version: 2.4.3
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: an asset gemification of the Weather 7 icon font library
122
+ test_files:
123
+ - test/dummy/app/assets/stylesheets/sass-import.css.sass
124
+ - test/dummy/app/assets/stylesheets/scss-import.css.scss
125
+ - test/dummy/app/assets/stylesheets/sprockets-require.css
126
+ - test/dummy/app/controllers/pages_controller.rb
127
+ - test/dummy/app/views/pages/icons.html.erb
128
+ - test/dummy/config/application.rb
129
+ - test/dummy/config/boot.rb
130
+ - test/dummy/config/environment.rb
131
+ - test/dummy/config/initializers/secret_token.rb
132
+ - test/dummy/config/routes.rb
133
+ - test/dummy/config.ru
134
+ - test/dummy/log/test.log
135
+ - test/icon_helper_test.rb
136
+ - test/test_helper.rb
137
+ - test/weather_seven_rails_test.rb