Skip to content

Commit

Permalink
adding Gemfile, to get specs running just bundle and rake - closes ry…
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanb committed Oct 5, 2010
1 parent 8f49f28 commit 18b45d5
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.gem
Gemfile.lock
.bundle
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--color
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source "http://rubygems.org"
gemspec
8 changes: 8 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ This will only work when abilities are defined using hash conditions, not blocks
* {Admin Namespace}[http://wiki.github.com/ryanb/cancan/admin-namespace]
* {See more}[http://wiki.github.com/ryanb/cancan/]


== Questions or Problems?

If you have any issues with CanCan which you cannot find the solution to in the documentation, please add an {issue on GitHub}. Or better yet, fork the project and make a pull request.

To get the specs running you should call +bundle+ and then +rake+. Specs currently do not work in Ruby 1.9 due to the RR mocking framework.


== Special Thanks

CanCan was inspired by declarative_authorization[http://github.com/stffn/declarative_authorization/] and aegis[http://github.com/makandra/aegis]. Also many thanks to the CanCan contributors[http://github.com/ryanb/cancan/contributors]. See the CHANGELOG[http://github.com/ryanb/cancan/blob/master/CHANGELOG.rdoc] for the full list.
11 changes: 4 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
require 'rubygems'
require 'rake'
require 'spec/rake/spectask'
require 'rspec/core/rake_task'

spec_files = Rake::FileList["spec/**/*_spec.rb"]

desc "Run specs"
Spec::Rake::SpecTask.new do |t|
t.spec_files = spec_files
t.spec_opts = ["-c"]
desc "Run RSpec"
RSpec::Core::RakeTask.new do |t|
t.verbose = false
end

task :default => :spec
4 changes: 4 additions & 0 deletions cancan.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Gem::Specification.new do |s|
s.files = Dir["{lib,spec}/**/*", "[A-Z]*", "init.rb"]
s.require_path = "lib"

s.add_development_dependency 'rspec', '~> 2.0.0.beta.22'
s.add_development_dependency 'rails', '~> 3.0.0'
s.add_development_dependency 'rr', '~> 0.10.11' # 1.0.0 has respond_to? issues: http://github.com/btakita/rr/issues/issue/43

s.rubyforge_project = s.name
s.required_rubygems_version = ">= 1.3.4"
end
2 changes: 1 addition & 1 deletion spec/cancan/ability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class A; include B; end
end

it "should have variables for action and subject" do
I18n.backend.store_translations :en, :unauthorized => {:manage => {:all => "{{action}} {{subject}}"}} # old syntax for now in case testing with old I18n
I18n.backend.store_translations :en, :unauthorized => {:manage => {:all => "%{action} %{subject}"}} # old syntax for now in case testing with old I18n
@ability.unauthorized_message(:update, Array).should == "update array"
@ability.unauthorized_message(:edit, 1..3).should == "edit range"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/matchers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Spec::Matchers.define :orderlessly_match do |original_string|
RSpec::Matchers.define :orderlessly_match do |original_string|
match do |given_string|
original_string.split('').sort == given_string.split('').sort
end
Expand Down
10 changes: 4 additions & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
require 'rubygems'
require 'spec'
require 'active_support'
require 'active_record'
require 'action_controller'
require 'action_view'
require 'bundler'
Bundler.require(:default, :test)
require 'active_support/all'
require 'matchers'
require 'cancan'
require 'cancan/matchers'

Spec::Runner.configure do |config|
RSpec.configure do |config|
config.mock_with :rr
end

Expand Down

0 comments on commit 18b45d5

Please sign in to comment.