File: six_initialize_spec.rb

package info (click to toggle)
ruby-six 0.2.0-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 196 kB
  • sloc: ruby: 295; makefile: 6
file content (37 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require "./spec/spec_helper"
require "./lib/six"

describe Six, "initialize" do 
  describe "initalization" do 
    before do 
      @jim = Author.new("Jim")
      @mike = Author.new("Mike")

      @jims_book = Book.new("The Game", @jim)
      @mikes_book = Book.new("Life", @mike)
    end

    it "should create authorization object" do 
      Six.new.should be_kind_of(Six)
    end

    it "should raise error if invalid argument passed" do 
      lambda { Six.new("wrong argument") }.should raise_error Six::InitializeArgumentError
    end

    it "should create authorization object" do 
      Six.new(:book_rules => BookRules.new).should be_kind_of(Six)
    end

    it "should create authorization object" do 
      Six.new(:book0 => BookRules.new, :book1 => BookRules.new).should be_kind_of(Six)
    end

    describe "passing rules on initialization" do 
      it_should_behave_like :valid_abilities do 
        let(:abilities) { Six.new(:book_rules => BookRules.new) }
        let(:rules_key) { :book_rules }
      end
    end
  end
end