Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added more comparison specs to data_mapper_adapter_spec.rb #839

Open
wants to merge 1 commit into from

2 participants

Aleksey Dreval xhoy
Aleksey Dreval

I hope this small addition would compliment the spec.

Aleksey Dreval antennas2heaven commented on the diff
spec/cancan/ability_spec.rb
@@ -19,7 +19,7 @@
it "should pass true to `can?` when non false/nil is returned in block" do
@ability.can :read, :all
@ability.can :read, Symbol do |sym|
- "foo" # TODO test that sym is nil when no instance is passed

The comment was removed since the required test is already placed just below this line.
Isn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
xhoy

Dear submitter, Since cancan/raynB hasn't been active for more than 6 months and no body else then ryam himself has commit permissions the cancan project is on a stand still.
Since cancan has several issues including missing support for rails 4 cancan is moving forward to cancancan. More details on: #994

If your feel that your pull request or bug is still applicable (and hasn't been merged in to cancan) it would be really appreciated if you would resubmit it to cancancan (https://github.com/cancancommunity/cancancan)

We hope to see you on the other side!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  spec/cancan/ability_spec.rb
View
@@ -19,7 +19,7 @@
it "should pass true to `can?` when non false/nil is returned in block" do
@ability.can :read, :all
@ability.can :read, Symbol do |sym|
- "foo" # TODO test that sym is nil when no instance is passed

The comment was removed since the required test is already placed just below this line.
Isn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ "foo"
end
@ability.can?(:read, :some_symbol).should == true
end
21 spec/cancan/model_adapters/data_mapper_adapter_spec.rb
View
@@ -114,6 +114,25 @@ class Comment
@ability.should_not be_able_to(:read, article3)
end
- # TODO: add more comparison specs
+ it "should match lt condition" do
+ @ability.can :read, Article, :priority.lt => 4
+ article1 = Article.create(:priority => 4)
+ article2 = Article.create(:priority => 3)
+ Article.accessible_by(@ability).should == [article2]
+ @ability.should be_able_to(:read, article2)
+ @ability.should_not be_able_to(:read, article1)
+ end
+
+ it "should match lte condition" do
+ @ability.can :read, Article, :priority.lte => 4
+ article1 = Article.create(:priority => 5)
+ article2 = Article.create(:priority => 4)
+ article3 = Article.create(:priority => 3)
+ Article.accessible_by(@ability).should == [article2, article3]
+ @ability.should be_able_to(:read, article2)
+ @ability.should be_able_to(:read, article3)
+ @ability.should_not be_able_to(:read, article1)
+ end
+
end
end
Something went wrong with that request. Please try again.