Sha256: 6e8b0c19ef59becb1d19311370debad64a76700615a44cb9bd3562b4b7beacb9

Contents?: true

Size: 1.72 KB

Versions: 16

Compression:

Stored size: 1.72 KB

Contents

require "spec_helper"

describe Mongoid::Extensions::String::Inflections do

  describe "#singular?" do

    context "when singular" do

      it "returns true" do
        "bat".singular?.should be_true
      end

      context "when string is added to inflections" do

        it "returns true" do
          "address".singular?.should be_true
        end

      end

    end

    context "when plural" do

      it "returns false" do
        "bats".singular?.should be_false
      end

      context "when string is added to inflections" do

        it "returns false" do
          "addresses".singular?.should be_false
        end

      end

    end

  end

  describe "plural?" do

    context "when singular" do

      it "returns false" do
        "bat".plural?.should be_false
      end

      context "when string is added to inflections" do

        it "returns false" do
          "address".plural?.should be_false
        end

      end

    end

    context "when plural" do

      it "returns true" do
        "bats".plural?.should be_true
      end

      context "when string is added to inflections" do

        it "returns true" do
          "addresses".plural?.should be_true
        end

      end

    end

  end

  describe "invert" do

    context "when asc" do

      it "returns desc" do
        "asc".invert.should == "desc"
      end

    end

    context "when ascending" do

      it "returns descending" do
        "ascending".invert.should == "descending"
      end

    end

    context "when desc" do

      it "returns asc" do
        "desc".invert.should == "asc"
      end

    end

    context "when descending" do

      it "returns ascending" do
        "descending".invert.should == "ascending"
      end

    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mongoid-0.12.0 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.9 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.8 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.7 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.6 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.5 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.4 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.3 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.2 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.1 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.11.0 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.10.6 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.10.5 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.10.4 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.10.3 spec/unit/mongoid/extensions/string/inflections_spec.rb
mongoid-0.10.2 spec/unit/mongoid/extensions/string/inflections_spec.rb