Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes for tests in rails 3.0

  • Loading branch information...
commit 0a6de72a5fd881fecd9b063144a6c08f4c319c69 1 parent a43994f
@bogdan authored
View
1  Gemfile
@@ -9,6 +9,7 @@ group :development do
gem "debugger", :platform => "ruby_19"
+ gem "byebug", :platform => "ruby_20"
gem "ruby-debug", :platform => "ruby_18"
gem "rspec"
View
10 spec/datagrid/core_spec.rb
@@ -15,7 +15,7 @@
context 'in the class' do
let(:report) { report_class.new }
- it { expect(report.scope).to have(2).item }
+ it { expect(report.scope.to_a).to have(2).item }
end
context 'changes scope on the fly' do
@@ -25,25 +25,25 @@
end
end
- it { expect(report.scope).to have(1).item }
+ it { expect(report.scope.to_a).to have(1).item }
end
context 'overriding scope by initializer' do
let(:report) { report_class.new { Entry.limit(1) } }
- it { expect(report.scope).to have(1).item }
+ it { expect(report.scope.to_a).to have(1).item }
context "reset scope to default" do
before do
report.reset_scope
end
- it { expect(report.scope).to have(2).item }
+ it { expect(report.scope.to_a).to have(2).item }
end
end
context "appending scope by initializer " do
let(:report) { report_class.new {|scope| scope.limit(1)} }
- it { expect(report.scope).to have(1).item }
+ it { expect(report.scope.to_a).to have(1).item }
it { expect(report.scope.order_values).to have(1).item }
end
end
View
19 spec/datagrid/form_builder_spec.rb
@@ -234,12 +234,23 @@ class MyTemplate
end
end
let(:_filter) { :category }
- it { should equal_to_dom(
- '
+ if Rails.version >= "4.0"
+ it { should equal_to_dom(
+ '
<label class="category enum_filter checkboxes" for="report_category_first"><input id="report_category_first" name="report[category][]" type="checkbox" value="first" />first</label>
<label class="category enum_filter checkboxes" for="report_category_second"><input id="report_category_second" name="report[category][]" type="checkbox" value="second" />second</label>
-'
- )}
+ '
+ )}
+ else
+ it { should equal_to_dom(
+ '
+<label class="category enum_filter checkboxes" for="report_category_first"><input name="report[category][]" type="hidden"><input id="report_category_first" name="report[category][]" type="checkbox" value="first" />first</label>
+<label class="category enum_filter checkboxes" for="report_category_second"><input name="report[category][]" type="hidden"><input id="report_category_second" name="report[category][]" type="checkbox" value="second" />second</label>
+ '
+ )}
+
+
+ end
end
end
View
8 spec/spec_helper.rb
@@ -25,6 +25,14 @@
require 'rspec'
require "logger"
+class DatagridTest < Rails::Application
+
+end
+
+if I18n.respond_to?(:enforce_available_locales)
+ I18n.enforce_available_locales = true
+end
+
File.open('spec.log', "w").close
TEST_LOGGER = Logger.new('spec.log')
View
1  spec/support/configuration.rb
@@ -25,3 +25,4 @@ def with_datetime_format(format = "%m/%d/%Y")
end
end
end
+
Please sign in to comment.
Something went wrong with that request. Please try again.