adding Gemfile, to get specs running just bundle and rake - closes #163

This commit is contained in:
Ryan Bates 2010-10-05 10:09:37 -07:00
parent 8f49f28713
commit 18b45d5cfc
9 changed files with 27 additions and 15 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
*.gem
Gemfile.lock
.bundle

1
.rspec Normal file
View File

@ -0,0 +1 @@
--color

2
Gemfile Normal file
View File

@ -0,0 +1,2 @@
source "http://rubygems.org"
gemspec

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -379,7 +379,7 @@ describe CanCan::Ability do
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

View File

@ -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

View File

@ -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