Sha256: 9e73745cde30ecda38c3c43f994f55e7deb0569ec6af260b865bbc7e60cf7694

Contents?: true

Size: 1.86 KB

Versions: 19

Compression:

Stored size: 1.86 KB

Contents

# -*- encoding : utf-8 -*-

module SetPatternSpecHelper
  def it_generates( opts )
    name = opts[:name]
    card = opts[:from]
    it "generates name '#{name}' for card '#{card.name}'" do
      expect(described_class.new(card).to_s).to eq(name)
    end
  end
end

include SetPatternSpecHelper

describe Card::SetPattern do
end

#FIXME - these should probably be in pattern-specific specs, though that may not leave much to test in the base class :)

describe Card::RightSet do
  it_generates :name => "author+*right", :from => Card.new( :name => "Iliad+author" )
  it_generates :name => "author+*right", :from => Card.new( :name => "+author" )
end

describe Card::TypeSet do
  it_generates :name => "Book+*type", :from => Card.new( :type => "Book" )
end

describe Card::TypeSet do
  before :each do
    Card::Auth.as_bot do
      @mylist = Card.create! :name=>'MyList', :type_id=>Card::CardtypeID
      Card.create :name=>'MyList+*type+*default', :type_id=>Card::PointerID
    end
    @mylist_card = Card.create :name=>'ip', :type_id=>@mylist.id
  end
  # similar tests for an inherited type of Pointer
  it 'has inherited set module' do
    expect(@mylist_card.set_format_modules(Card::HtmlFormat)).to include(Card::Set::Type::Pointer::HtmlFormat)
    expect(@mylist_card.set_format_modules(Card::CssFormat)).to include(Card::Set::Type::Pointer::CssFormat)
    expect(@mylist_card.set_format_modules(Card::JsFormat)).to include(Card::Set::Type::Pointer::JsFormat)
    expect(@mylist_card.set_modules).to include(Card::Set::Type::Pointer)
  end
end

describe Card::AllPlusSet do
  it_generates :name => "*all plus", :from => Card.new( :name => "Book+author" )
end

describe Card::AllSet do
  it_generates :name => "*all", :from => Card.new( :type => "Book" )
end

describe Card::TypePlusRightSet do
  it_generates :name => "Book+author+*type plus right", :from => Card.new( :name=>"Iliad+author" )
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
card-1.16.6 spec/lib/card/set_pattern_spec.rb
card-1.16.5 spec/lib/card/set_pattern_spec.rb
card-1.16.4 spec/lib/card/set_pattern_spec.rb
card-1.16.3 spec/lib/card/set_pattern_spec.rb
card-1.16.2 spec/lib/card/set_pattern_spec.rb
card-1.16.1 spec/lib/card/set_pattern_spec.rb
card-1.16.0 spec/lib/card/set_pattern_spec.rb
card-1.15.7 spec/lib/card/set_pattern_spec.rb
card-1.15.6 spec/lib/card/set_pattern_spec.rb
card-1.15.5 spec/lib/card/set_pattern_spec.rb
card-1.15.4 spec/lib/card/set_pattern_spec.rb
card-1.15.3 spec/lib/card/set_pattern_spec.rb
card-1.15.2 spec/lib/card/set_pattern_spec.rb
card-1.15.1 spec/lib/card/set_pattern_spec.rb
card-1.15.0 spec/lib/card/set_pattern_spec.rb
card-1.15.pre2 spec/lib/card/set_pattern_spec.rb
card-1.15.pre spec/lib/card/set_pattern_spec.rb
wagn-1.14.9 spec/lib/card/set_pattern_spec.rb
wagn-1.14.8 spec/lib/card/set_pattern_spec.rb