spec/sakuramochi/relation_spec.rb in sakuramochi-0.5.0 vs spec/sakuramochi/relation_spec.rb in sakuramochi-0.5.1
- old
+ new
@@ -23,7 +23,21 @@
before { @users = User.where([{:name_contains => 'あいら'}, :or, {:name_contains => 'りずむ'}]) }
subject { @users }
it { subject.map(&:name).should_not be_match_all /みおん/ }
end
+
+ describe 'nested' do
+ before do
+ @users = User.where([
+ [{:name_contains => '春音'}, :and, {:name_contains => 'あいら'}],
+ :or, [{:name_contains => '天宮'}, :and, {:name_contains => 'りずむ'}]
+ ])
+ end
+ subject { @users }
+
+ it { should have(2).items }
+ it { subject.map(&:name).should_not be_match_all /うる|える/ }
+ it { subject.map(&:name).should_not be_match_all /みおん/ }
+ end
end
end