Skip to content

Commit 47c8fa7

Browse files
committed
release new version
1 parent 76e2be4 commit 47c8fa7

File tree

5 files changed

+92
-98
lines changed

5 files changed

+92
-98
lines changed

Rakefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ require 'rspec/core/rake_task'
44
desc 'Default: run specs.'
55
task :default => :spec
66

7-
desc "Run specs"
7+
desc 'Run specs'
88
RSpec::Core::RakeTask.new do |t|
9-
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
9+
t.pattern = './spec/**/*_spec.rb' # don't need this, it's default.
1010
# Put spec opts in a file named .rspec in root
1111
end
1212

13-
desc "Generate code coverage"
13+
desc 'Generate code coverage'
1414
RSpec::Core::RakeTask.new(:coverage) do |t|
15-
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
15+
t.pattern = './spec/**/*_spec.rb' # don't need this, it's default.
1616
t.rcov = true
1717
t.rcov_opts = ['--exclude', 'spec']
18-
end
18+
end

bootstrap_forms.gemspec

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
# encoding: utf-8
2-
$:.push File.expand_path("../lib", __FILE__)
2+
$:.push File.expand_path('../lib', __FILE__)
33

44
Gem::Specification.new do |s|
5-
s.name = "bootstrap_forms"
6-
s.version = "2.0.4"
7-
s.author = "Seth Vargo"
8-
s.email = "[email protected]"
9-
s.homepage = "https://github.com/sethvargo/bootstrap_forms"
5+
s.name = 'bootstrap_forms'
6+
s.version = '2.0.5'
7+
s.author = 'Seth Vargo'
8+
s.email = '[email protected]'
9+
s.homepage = 'https://github.com/sethvargo/bootstrap_forms'
1010
s.summary = %q{Bootstrap Forms makes Twitter's Bootstrap on Rails easy!}
1111
s.description = %q{Bootstrap Forms makes Twitter's Bootstrap on Rails easy to use by creating helpful form builders that minimize markup in your views.}
1212

1313
s.files = `git ls-files`.split("\n")
1414
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
1515
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16-
s.require_paths = ["lib"]
16+
s.require_paths = ['lib']
1717

18-
s.add_development_dependency "rspec-rails", "~> 2.10.1"
19-
s.add_development_dependency "capybara", "~> 1.1.0"
20-
s.add_development_dependency "rake"
21-
s.add_development_dependency "rails", "~> 3.2.0"
22-
s.add_development_dependency "guard-rspec"
23-
s.add_development_dependency "sqlite3"
18+
s.add_development_dependency 'rspec-rails', '~> 2.12.0'
19+
s.add_development_dependency 'capybara', '~> 2.0.0'
20+
s.add_development_dependency 'rake'
21+
s.add_development_dependency 'rails', '~> 3.2.0'
22+
s.add_development_dependency 'guard-rspec'
23+
s.add_development_dependency 'sqlite3'
2424
end

spec/lib/bootstrap_forms/bootstrap_form_for_spec.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
require 'spec_helper'
22

3-
describe "bootstrap_form_for" do
4-
describe "default_form_builder" do
5-
it "should be accessible" do
3+
describe 'bootstrap_form_for' do
4+
describe 'default_form_builder' do
5+
it 'should be accessible' do
66
BootstrapForms.should respond_to(:default_form_builder)
77
end
88

9-
it "should be the BootstrapForms form_builder by default" do
9+
it 'should be the BootstrapForms form_builder by default' do
1010
BootstrapForms.default_form_builder.should == BootstrapForms::FormBuilder
1111
end
1212

13-
context "when set to something else" do
13+
context 'when set to something else' do
1414
before do
1515
BootstrapForms.default_form_builder = MyCustomFormBuilder
1616
end
1717

18-
it "should be that other thing" do
18+
it 'should be that other thing' do
1919
BootstrapForms.default_form_builder.should == MyCustomFormBuilder
2020
end
2121

22-
describe "projects/new.html.erb", :type => :view do
22+
describe 'projects/new.html.erb', :type => :view do
2323
before do
2424
assign :project, Project.new
25-
render :file => "projects/new.html.erb", :layout => "layouts/application.html.erb"
25+
render :file => 'projects/new.html.erb', :layout => 'layouts/application.html.erb'
2626
end
2727

28-
it "should render with the other form builder" do
28+
it 'should render with the other form builder' do
2929
# in other words, it shouldn't be wrapped with the bootstrap stuff
3030
rendered.should_not match /<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name<\/label><div class=\"controls\">.*<\/div><\/div>/
3131
end

spec/spec_helper.rb

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
# This file was generated by the `rspec --init` command. Conventionally, all
2-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3-
# Require this file using `require "spec_helper.rb"` to ensure that it is only
4-
# loaded once.
5-
#
6-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
1+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
82

93
require 'rspec/rails'
104
require 'capybara/rspec'
@@ -22,4 +16,4 @@
2216
config.include RSpec::Rails::ViewExampleGroup, :type => :view
2317
end
2418

25-
Rails.backtrace_cleaner.remove_silencers!
19+
Rails.backtrace_cleaner.remove_silencers!

spec/support/shared_context.rb

+63-63
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
shared_examples "a bootstrap form" do
2-
describe "with no options" do
3-
describe "error_messages" do
4-
it "returns empty string without errors" do
5-
@builder.error_messages.should == ""
1+
shared_examples 'a bootstrap form' do
2+
describe 'with no options' do
3+
describe 'error_messages' do
4+
it 'returns empty string without errors' do
5+
@builder.error_messages.should == ''
66
end
77
end
88

9-
describe "text_area" do
9+
describe 'text_area' do
1010
before(:each) do
11-
@result = @builder.text_area "name"
11+
@result = @builder.text_area 'name'
1212
end
1313

14-
it "has textarea input" do
14+
it 'has textarea input' do
1515
@result.should match /textarea/
1616
end
1717
end
1818

19-
describe "uneditable_input" do
20-
it "generates wrapped input" do
21-
@builder.uneditable_input("name").should == "<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><span class=\"uneditable-input\"></span></div></div>"
19+
describe 'uneditable_input' do
20+
it 'generates wrapped input' do
21+
@builder.uneditable_input('name').should == "<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><span class=\"uneditable-input\"></span></div></div>"
2222
end
2323

24-
it "allows for an id" do
25-
@builder.uneditable_input("name", :id => "myid").should match /<span.*id="myid"/
24+
it 'allows for an id' do
25+
@builder.uneditable_input('name', :id => 'myid').should match /<span.*id="myid"/
2626
end
2727
end
2828

29-
describe "check_box" do
30-
it "generates wrapped input" do
31-
@builder.check_box("name").should == "<div class=\"control-group\"><div class=\"controls\"><label class=\"checkbox\" for=\"item_name\"><input name=\"item[name]\" type=\"hidden\" value=\"0\" /><input id=\"item_name\" name=\"item[name]\" type=\"checkbox\" value=\"1\" />Name</label></div></div>"
29+
describe 'check_box' do
30+
it 'generates wrapped input' do
31+
@builder.check_box('name').should == "<div class=\"control-group\"><div class=\"controls\"><label class=\"checkbox\" for=\"item_name\"><input name=\"item[name]\" type=\"hidden\" value=\"0\" /><input id=\"item_name\" name=\"item[name]\" type=\"checkbox\" value=\"1\" />Name</label></div></div>"
3232
end
3333

34-
it "allows custom label" do
35-
@builder.check_box("name", :label => "custom label").should match /custom label<\/label>/
34+
it 'allows custom label' do
35+
@builder.check_box('name', :label => 'custom label').should match /custom label<\/label>/
3636
end
3737

38-
it "allows no label with :label => false " do
39-
@builder.check_box("name", :label => false).should_not match /<\/label>/
38+
it 'allows no label with :label => false ' do
39+
@builder.check_box('name', :label => false).should_not match /<\/label>/
4040
end
41-
it "allows no label with :label => '' " do
42-
@builder.check_box("name", :label => '').should_not match /<\/label>/
41+
it 'allows no label with :label => '' ' do
42+
@builder.check_box('name', :label => '').should_not match /<\/label>/
4343
end
4444
end
4545

46-
describe "radio_buttons" do
46+
describe 'radio_buttons' do
4747
before do
4848
if RUBY_VERSION < '1.9'
4949
@options = ActiveSupport::OrderedHash.new
@@ -54,37 +54,37 @@
5454
end
5555
end
5656

57-
it "doesn't use field_options from previously generated field" do
57+
it 'doesn\'t use field_options from previously generated field' do
5858
@builder.text_field :name, :label => 'Heading', :help_inline => 'Inline help', :help_block => 'Block help'
5959
@builder.radio_buttons(:name, @options).should == "<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><label class=\"radio\" for=\"item_name_1\"><input id=\"item_name_1\" name=\"item[name]\" type=\"radio\" value=\"1\" />One</label><label class=\"radio\" for=\"item_name_2\"><input id=\"item_name_2\" name=\"item[name]\" type=\"radio\" value=\"2\" />Two</label></div></div>"
6060
end
6161

62-
it "sets field_options" do
63-
@builder.radio_buttons(:name, {"One" => "1", "Two" => "2"})
64-
@builder.instance_variable_get("@field_options").should == {:error => nil}
62+
it 'sets field_options' do
63+
@builder.radio_buttons(:name, {'One' => '1', 'Two' => '2'})
64+
@builder.instance_variable_get('@field_options').should == {:error => nil}
6565
end
6666

67-
it "generates wrapped input" do
67+
it 'generates wrapped input' do
6868
@builder.radio_buttons(:name, @options).should == "<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><label class=\"radio\" for=\"item_name_1\"><input id=\"item_name_1\" name=\"item[name]\" type=\"radio\" value=\"1\" />One</label><label class=\"radio\" for=\"item_name_2\"><input id=\"item_name_2\" name=\"item[name]\" type=\"radio\" value=\"2\" />Two</label></div></div>"
6969
end
7070

71-
it "allows custom label" do
72-
@builder.radio_buttons(:name, @options, {:label => "custom label"}).should match /custom label<\/label>/
71+
it 'allows custom label' do
72+
@builder.radio_buttons(:name, @options, {:label => 'custom label'}).should match /custom label<\/label>/
7373
end
74-
75-
it "allows no label" do
74+
75+
it 'allows no label' do
7676
@builder.radio_buttons(:name, @options, {:label => false}).should == "<div class=\"control-group\"><div class=\"controls\"><label class=\"radio\" for=\"item_name_1\"><input id=\"item_name_1\" name=\"item[name]\" type=\"radio\" value=\"1\" />One</label><label class=\"radio\" for=\"item_name_2\"><input id=\"item_name_2\" name=\"item[name]\" type=\"radio\" value=\"2\" />Two</label></div></div>"
7777
end
7878
end
7979

80-
(%w{email file number password range search text url }.map{|field| ["#{field}_field",field]} + [["telephone_field", "tel"], ["phone_field", "tel"]]).each do |field, type|
80+
(%w{email file number password range search text url }.map{|field| ["#{field}_field",field]} + [['telephone_field', 'tel'], ['phone_field', 'tel']]).each do |field, type|
8181
describe "#{field}" do
82-
context "result" do
82+
context 'result' do
8383
before(:each) do
84-
@result = @builder.send(field, "name")
84+
@result = @builder.send(field, 'name')
8585
end
8686

87-
it "is wrapped" do
87+
it 'is wrapped' do
8888
@result.should match /^<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name<\/label><div class=\"controls\">.*<\/div><\/div>$/
8989
end
9090

@@ -93,107 +93,107 @@
9393
end
9494
end # result
9595

96-
context "call expectations" do
96+
context 'call expectations' do
9797
%w(control_group_div label_field input_div extras).map(&:to_sym).each do |method|
9898
it "calls #{method}" do
9999
@builder.should_receive(method).and_return("")
100100
end
101101
end
102102

103103
after(:each) do
104-
@builder.send(field, "name")
104+
@builder.send(field, 'name')
105105
end
106106
end # call expectations
107107

108108
end # field
109109
end # fields
110110
end # no options
111111

112-
describe "extras" do
113-
context "text_field" do
114-
it "adds span for inline help" do
112+
describe 'extras' do
113+
context 'text_field' do
114+
it 'adds span for inline help' do
115115
@builder.text_field(:name, :help_inline => 'help me!').should == "<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><input id=\"item_name\" name=\"item[name]\" size=\"30\" type=\"text\" /><span class=\"help-inline\">help me!</span></div></div>"
116116
end
117117

118-
it "adds help block" do
118+
it 'adds help block' do
119119
@builder.text_field(:name, :help_block => 'help me!').should == "<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><input id=\"item_name\" name=\"item[name]\" size=\"30\" type=\"text\" /><p class=\"help-block\">help me!</p></div></div>"
120120
end
121121

122-
it "adds error message and class" do
122+
it 'adds error message and class' do
123123
@builder.text_field(:name, :error => 'This is an error!').should == "<div class=\"control-group error\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><input id=\"item_name\" name=\"item[name]\" size=\"30\" type=\"text\" /><span class=\"help-inline\">This is an error!</span></div></div>"
124124
end
125125

126-
it "adds success message and class" do
126+
it 'adds success message and class' do
127127
@builder.text_field(:name, :success => 'This checked out OK').should == "<div class=\"control-group success\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><input id=\"item_name\" name=\"item[name]\" size=\"30\" type=\"text\" /><span class=\"help-inline\">This checked out OK</span></div></div>"
128128
end
129129

130-
it "adds warning message and class" do
130+
it 'adds warning message and class' do
131131
@builder.text_field(:name, :warning => 'Take a look at this...').should == "<div class=\"control-group warning\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><input id=\"item_name\" name=\"item[name]\" size=\"30\" type=\"text\" /><span class=\"help-inline\">Take a look at this...</span></div></div>"
132132
end
133133

134-
it "prepends passed text" do
134+
it 'prepends passed text' do
135135
@builder.text_field(:name, :prepend => '@').should == "<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><div class=\"input-prepend\"><span class=\"add-on\">@</span><input id=\"item_name\" name=\"item[name]\" size=\"30\" type=\"text\" /></div></div></div>"
136136
end
137137

138-
it "appends passed text" do
138+
it 'appends passed text' do
139139
@builder.text_field(:name, :append => '@').should == "<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><div class=\"input-append\"><input id=\"item_name\" name=\"item[name]\" size=\"30\" type=\"text\" /><span class=\"add-on\">@</span></div></div></div>"
140140
end
141141

142-
it "prepends and appends passed text" do
142+
it 'prepends and appends passed text' do
143143
@builder.text_field(:name, :append => '@', :prepend => '#').should == "<div class=\"control-group\"><label class=\"control-label\" for=\"item_name\">Name</label><div class=\"controls\"><div class=\"input-prepend input-append\"><span class=\"add-on\">\#</span><input id=\"item_name\" name=\"item[name]\" size=\"30\" type=\"text\" /><span class=\"add-on\">@</span></div></div></div>"
144144
end
145145
end
146146

147-
context "label option" do
147+
context 'label option' do
148148
%w(select email_field file_field number_field password_field search_field text_area text_field url_field).each do |method_name|
149-
149+
150150
it "should not add a label when ''" do
151151
@builder.send(method_name.to_sym, 'name', :label => '').should_not match /<\/label>/
152152
end
153153

154-
it "should not add a label when false" do
154+
it 'should not add a label when false' do
155155
@builder.send(method_name.to_sym, 'name', :label => false).should_not match /<\/label>/
156156
end
157157
end
158158
end
159159
end # extras
160160

161-
describe "form actions" do
162-
context "actions" do
163-
it "adds additional block content" do
161+
describe 'form actions' do
162+
context 'actions' do
163+
it 'adds additional block content' do
164164
@builder.actions do
165165
@builder.submit
166166
end.should match(/<div class=\"form-actions\">.*?<\/div>/)
167167
end
168168
end
169169

170-
context "submit" do
171-
it "adds btn primary class if no class is defined" do
170+
context 'submit' do
171+
it 'adds btn primary class if no class is defined' do
172172
@builder.submit.should match /class=\"btn btn-primary\"/
173173
end
174174

175-
it "allows for custom classes" do
175+
it 'allows for custom classes' do
176176
@builder.submit(:class => 'btn btn-large btn-success').should match /class=\"btn btn-large btn-success\"/
177177
end
178178
end
179179

180-
context "button" do
181-
it "adds btn primary class if no class is defined" do
180+
context 'button' do
181+
it 'adds btn primary class if no class is defined' do
182182
@builder.button.should match /class=\"btn btn-primary\"/
183183
end
184184

185-
it "allows for custom classes" do
185+
it 'allows for custom classes' do
186186
@builder.button(:class => 'btn btn-large btn-success').should match /class=\"btn btn-large btn-success\"/
187187
end
188188
end
189189

190-
context "cancel" do
191-
it "creates a link with cancel btn class if no class is defined" do
190+
context 'cancel' do
191+
it 'creates a link with cancel btn class if no class is defined' do
192192
@builder.should_receive(:link_to).with(I18n.t('bootstrap_forms.buttons.cancel'), :back, :class => 'btn cancel').and_return("")
193193
@builder.cancel
194194
end
195195

196-
it "creates a link with custom classes when defined" do
196+
it 'creates a link with custom classes when defined' do
197197
@builder.should_receive(:link_to).with(I18n.t('bootstrap_forms.buttons.cancel'), :back, :class => 'btn btn-large my-cancel').and_return("")
198198
@builder.cancel(:class => 'btn btn-large my-cancel')
199199
end

0 commit comments

Comments
 (0)