Sha256: ceafca83b2352a989b34eefdb32140f493beee423f624a7f144301be149bb0a1

Contents?: true

Size: 1.21 KB

Versions: 18

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require "assert"
require "much-rails/view_models/breadcrumb"

class MuchRails::ViewModels::Breadcrumb
  class UnitTests < Assert::Context
    desc "MuchRails::ViewModels::Breadcrumb"
    subject{ unit_class }

    let(:unit_class){ MuchRails::ViewModels::Breadcrumb }
  end

  class InitTests < UnitTests
    desc "when init"
    subject{ unit_class.new }

    let(:name){ "name" }
    let(:url){ "url" }

    should have_readers :name, :url

    should have_imeths :render_as_link?

    should "know its name" do
      assert_that(subject.name).is_nil

      result = unit_class.new(name)
      assert_that(result.name).equals(name)

      result = unit_class.new(name, url)
      assert_that(result.name).equals(name)
    end

    should "know its url" do
      assert_that(subject.url).is_nil

      result = unit_class.new(name)
      assert_that(result.url).is_nil

      result = unit_class.new(name, url)
      assert_that(result.url).equals(url)
    end

    should "know if it should render as link" do
      result = unit_class.new(name, url)
      assert_that(result.render_as_link?).is_true

      result = unit_class.new(name)
      assert_that(result.render_as_link?).is_false
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
much-rails-0.4.3 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.4.2 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.4.1 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.4.0 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.3.0 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.2.8 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.2.7 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.2.6 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.2.5 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.2.4 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.2.3 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.2.2 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.2.1 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.2.0 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.1.3 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.1.2 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.1.1 test/unit/view_models/breadcrumb_tests.rb
much-rails-0.1.0 test/unit/view_models/breadcrumb_tests.rb