Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Style.

  • Loading branch information...
commit f84180504d732521c36f2c54ffcea80c2b94d4c2 1 parent 0ecb774
Gabe Berke-Williams gabebw authored
Showing with 9 additions and 15 deletions.
  1. +9 −15 spec/shoulda/active_record/query_the_database_matcher_spec.rb
24 spec/shoulda/active_record/query_the_database_matcher_spec.rb
View
@@ -1,9 +1,7 @@
require 'spec_helper'
describe Shoulda::Matchers::ActiveRecord::QueryTheDatabaseMatcher do
-
if ::ActiveRecord::VERSION::MAJOR == 3 && ::ActiveRecord::VERSION::MINOR >= 1
-
before do
@parent = define_model :litter do
has_many :kittens
@@ -13,47 +11,43 @@
end
end
- it "should accept the correct number of queries when there is a single query" do
+ it "accepts the correct number of queries when there is a single query" do
@parent.should query_the_database(1.times).when_calling(:count)
end
- it "should accept any number of queries when no number is specified" do
+ it "accepts any number of queries when no number is specified" do
@parent.should query_the_database.when_calling(:count)
end
- it "should reject any number of queries when no number is specified" do
+ it "rejects any number of queries when no number is specified" do
@parent.should_not query_the_database.when_calling(:to_s)
end
- it "should accept the correct number of queries when there are two queries" do
+ it "accepts the correct number of queries when there are two queries" do
nonsense = lambda do
@parent.create.kittens.create
end
nonsense.should query_the_database(2.times).when_calling(:call)
end
- it "should reject the wrong number of queries" do
+ it "rejects the wrong number of queries" do
@parent.should_not query_the_database(10.times).when_calling(:count)
end
- it "should accept fewer than the specified maximum" do
+ it "accepts fewer than the specified maximum" do
@parent.should query_the_database(5.times).or_less.when_calling(:count)
end
- it "should pass arguments to the method to examine" do
+ it "passes arguments to the method to examine" do
model = stub("Model", :count => nil)
model.expects(:count).with("arguments")
model.should_not query_the_database.when_calling(:count).with("arguments")
end
-
else
-
it "should raise an exception on Rails < 3.1" do
- lambda {
+ lambda do
@parent.should query_the_database(1.times).when_calling(:count)
- }.should raise_exception
+ end.should raise_exception
end
-
end
-
end
Please sign in to comment.
Something went wrong with that request. Please try again.