Code Monkey home page Code Monkey logo

rspec-cells's Introduction

Trailblazer

Battle-tested Ruby framework to help structuring your business logic.

Gem Version

What's Trailblazer?

Trailblazer introduces new abstraction layers into Ruby applications to help you structure your business logic.

It ships with our canonical "service object" implementation called operation, many conventions, gems for testing, Rails support, optional form objects and much more.

Should I use Trailblazer?

Give us a chance if you say "yes" to this!

  • You hate messy controller code but don't know where to put it?
  • Moving business code into the "fat model" gives you nightmares?
  • "Service objects" are great?
  • Anyhow, you're tired of 12 different "service object" implementations throughout your app?
  • You keep asking for additional layers such as forms, policies, decorators?

Yes? Then we got a well-seasoned framework for you: Trailblazer.

Here are the main concepts.

Operation

The operation encapsulates business logic and is the heart of the Trailblazer architecture.

An operation is not just a monolithic replacement for your business code. It's a simple orchestrator between the form objects, models, your business code and all other layers needed to get the job done.

# app/concepts/song/operation/create.rb
module Song::Operation
  class Create < Trailblazer::Operation
    step :create_model
    step :validate
    left :handle_errors
    step :notify

    def create_model(ctx, **)
      # do whatever you feel like.
      ctx[:model] = Song.new
    end

    def validate(ctx, params:, **)
      # ..
    end
    # ...
  end
end

The step DSL takes away the pain of flow control and error handling. You focus on what happens: creating models, validating data, sending out notifications.

Control flow

The operation takes care when things happen: the flow control. Internally, this works as depicted in this beautiful diagram.

Flow diagram of a typical operation.

The best part: the only way to invoke this operation is Operation.call. The single entry-point saves programmers from shenanigans with instances and internal state - it's proven to be an almost bullet-proof concept in the past 10 years.

result = Song::Operation::Create.(params: {title: "Hear Us Out", band: "Rancid"})

result.success? #=> true
result[:model]  #=> #<Song title="Hear Us Out" ...>

Data, computed values, statuses or models from within the operation run are exposed through the result object.

Operations can be nested, use composition and inheritance patterns, provide variable mapping around each step, support dependency injection, and save you from reinventing the wheel - over and over, again.

Leveraging those functional mechanics, operations encourage a high degree of encapsulation while giving you all the conventions and tools for free (except for a bit of a learning curve).

Tracing

In the past years, we learnt from some old mistakes and improved developer experience. As a starter, check out our built-in tracing!

result = Song::Operation::Create.wtf?(params: {title: "", band: "Rancid"})

Tracing the internal flow of an operation.

Within a second you know which step failed - a thing that might seem trivial, but when things grow and a deeply nested step in an iteration fails, you will start loving #wtf?! It has saved us days of debugging.

We even provide a visual debugger to inspect traces on the webs.

There's a lot more

All our abstraction layers such as operations, form objects, view components, test gems and much more are used in hundreds of OSS projects and commercial applications in the Ruby world.

We provide a visual debugger, a BPMN editor for long-running business processes, thorough documentation and a growing list of onboarding videos (TRAILBLAZER TALES).

Trailblazer is both used for refactoring legacy apps (we support Ruby 2.5+) and helps big teams organizing, structuring and debugging modern, growing (Rails) applications.

Documentation

Make sure to check out the new beginner's guide to learning Trailblazer. The new book discusses all aspects in a step-wise approach you need to understand Trailblazer's mechanics and design ideas.

The new begginer's guide.

rspec-cells's People

Contributors

apotonick avatar banyan avatar broisatse avatar calas avatar codemonkeysteve avatar docwhat avatar emaglio avatar eppo avatar fcheung avatar felipeik avatar flyerhzm avatar hsbt avatar imomoi avatar kpumuk avatar kyanny avatar maciej-ka avatar mauidude avatar nerian avatar opti avatar orien avatar pboling avatar petar-lazarov avatar pikachuexe avatar rweng avatar samstickland avatar seuros avatar shiro16 avatar timoschilling avatar willnet avatar yogeshjain999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rspec-cells's Issues

How to stub a view helper method?

Hello,

I have a view helper method that is used in almost all of my cells.

class MyCell << Cell::Rails
  helper :my_helper

  def show
    ...
  end

  ...
end

module MyHelper
  def my_helper_method
    ...
  end
end

How can I stub it? I tried

controller.stub(:my_helper_method)

render_cell(:my_cell, :show)

but this doesn't work and I have no clue what to look for to find the object that the method is later called on. Do you have an idea?

DEPRECATION WARNING specific to named_routes.helpers

When i was running the specs on rails 4.2 app with rspec-cells 0.2.2, getting the deprecation warning

DEPRECATION WARNING: named_routes.helpers is deprecated, please use route_defined?(route_name) to see if a named route was defined

I think this issue specific to dependency rspec-rails version, there was an issue on rspec-rails specific the issue rspec/rspec-rails#1187

CellExampleGroup and ExampleGroup

Both files look alike. Is there any reason to keep both ? If I read the commits correctly, I guess we can safely remove CellExampleGroup. Not 100% sure though

Generated spec uses "content:" instead of "text:" hash key for "have_selector"

Generated code:

it { should have_selector 'h1', content: 'MiniHub#show' }
it { should have_selector 'p', content: 'Find me in app/cells/mini_hub/show.html' }

Resulting in:

  1) MiniHubCell cell rendering rendering show should have selector "h1", {:content=>"MiniHub#show"}
     Failure/Error: it { should have_selector('h1', content: 'MiniHub#show') }
     ArgumentError:
       invalid keys :content, should be one of :text, :visible, :between, :count, :maximum, :minimum, :exact, :match, :wait
     # ./spec/cells/mini_hub_cell_spec.rb:15:in `block (4 levels) in <top (required)>'

  2) MiniHubCell cell rendering rendering show should have selector "p", {:content=>"Find me in app/cells/mini_hub/show.html"}
     Failure/Error: it { should have_selector('p', content: 'Find me in app/cells/mini_hub/show.html') }
     ArgumentError:
       invalid keys :content, should be one of :text, :visible, :between, :count, :maximum, :minimum, :exact, :match, :wait
     # ./spec/cells/mini_hub_cell_spec.rb:16:in `block (4 levels) in <top (required)>'

Working code (I guess):

it { should have_selector 'h1', text: 'MiniHub#show' }
it { should have_selector 'p', text: 'Find me in app/cells/mini_hub/show.html' }

rspec 3

Any plans to update this to use rspec 3?

If you use rspec & rspec-rails > 3.3.0 Fixture Error

There is an error with rspec-cells and rspec 3.3.0. I would bet it has something to do with the fixture support added in 3.3.0. Commit #1372

The problem resolves on rollback to rspec/rspec-rails 3.2 branch

/Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-rails-3.3.0/lib/rspec/rails/example/rails_example_group.rb:14:in `<module:RailsExampleGro
up>': uninitialized constant RSpec::Rails::FixtureSupport (NameError)
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-rails-3.3.0/lib/rspec/rails/example/rails_example_group.rb:8:in `<module:Rai
ls>'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-rails-3.3.0/lib/rspec/rails/example/rails_example_group.rb:6:in `<module:RSp
ec>'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-rails-3.3.0/lib/rspec/rails/example/rails_example_group.rb:5:in `<top (requi
red)>'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-cells-0.3.2/lib/rspec/cells.rb:5:in `<top (required)>'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-cells-0.3.2/lib/rspec-cells.rb:11:in `block in <class:Railtie>'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /Users/dsouthard/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
        from /Users/dsouthard/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
        from /Users/dsouthard/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
        from /Users/dsouthard/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
        from /Users/dsouthard/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
        from /Users/dsouthard/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
        from /Users/dsouthard/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
        from /Users/dsouthard/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
        from /Users/dsouthard/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
        from /Users/dsouthard/Documents/rails/directory/config/environment.rb:5:in `<top (required)>'
        from /Users/dsouthard/Documents/rails/directory/spec/spec_helper.rb:13:in `require'
        from /Users/dsouthard/Documents/rails/directory/spec/spec_helper.rb:13:in `<top (required)>'
        from /Users/dsouthard/Documents/rails/directory/spec/cells/api_cell_spec.rb:1:in `require'
        from /Users/dsouthard/Documents/rails/directory/spec/cells/api_cell_spec.rb:1:in `<top (required)>'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1327:in `load'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1327:in `block in load_spec_files
'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1325:in `each'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1325:in `load_spec_files'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:102:in `setup'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:88:in `run'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:73:in `run'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:41:in `invoke'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/gems/rspec-core-3.3.0/exe/rspec:4:in `<top (required)>'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/bin/rspec:23:in `load'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/bin/rspec:23:in `<main>'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/bin/ruby_executable_hooks:15:in `eval'
        from /Users/dsouthard/.rvm/gems/ruby-2.1.5@directory/bin/ruby_executable_hooks:15:in `<main>'
``

generator not generating capybara matcher

Hi,

when running the generator for a cell, the following lines are generated in spec/cells/

it { should have_selector("p", :content => "Find me in app/cells/share/show.html") }

capybara requires :text instead of :content ( at least in version 2.x). Thus, the specs fail:

Failure/Error: it { should have_selector("p", :content => "Find me in app/cells/share/show.html") }
     ArgumentError:
       invalid keys :content, should be one of :text, :visible, :between, :count, :maximum, :minimum, :exact, :match, :wait

Stubbing is broken in 0.1.11 and 0.2.1 using capybara

When Capybara is in the Gemfile, the stubbing works fine using rspec-cells 0.1.9 but is broken with 0.2.1. The reason seems to be the cell method:

let(:status_cell) { cell("status") }
it "debugs the class"
  puts status_cell.class
end

With 0.1.9, the class is StatusCell, while with 0.2.1 the class is RSpec::Rails::CellExampleGroup::Content, and stubbing methods in the status_cell object doesn't work as expected.

A workaround is to use StatusCell.any_instance.stub(...) or status_cell.instance_variable_get("@cell").stub(...), and both are ugly IMHO.

It seems to be related to a problem mentioned on issue #31, which was fixed with 6d619c3.

cannot load such file -- rspec (LoadError)

Latest rspec-cells and rspec do not play nice. rspec should now be loaded with require 'rspec/core'. This has been fixed in a fork, (see commit) by @mauidude, and should be pulled into the released gem, perhaps with a minor version bump, as it will not work with existing installations without also upgrading rspec.

generated test failed

I generate the sponsor cell by

rails generate cell sponsor active

and run the test with

rspec spec/cells/sponsor_cell_spec.rb

I got the following error

  1. SponsorCell cell rendering rendering active
    Failure/Error: subject { render_cell(:sponsor, :active) }
    NoMethodError:
    undefined method `string' for Capybara:Module

    ./spec/cells/sponsor_cell_spec.rb:7:in`block (4 levels) in <top (required)>'

    ./spec/cells/sponsor_cell_spec.rb:9:in `block (4 levels) in <top (required)>'

  2. SponsorCell cell rendering rendering active
    Failure/Error: subject { render_cell(:sponsor, :active) }
    NoMethodError:
    undefined method `string' for Capybara:Module

    ./spec/cells/sponsor_cell_spec.rb:7:in`block (4 levels) in <top (required)>'

    ./spec/cells/sponsor_cell_spec.rb:10:in `block (4 levels) in <top (required)>'

my capybara version is 0.3.9

Updating to master breaks 'rake' on Codeship

Hi,

When I update to 'master' the rake command breaks on codeship.

rof@railsonfire_95981500-275e-0133-512f-0efcb37b71e5_fa85a9fee872:~/clone$ bundle exec rake db:schema:load 
rake aborted!
missing run or map statement
/home/rof/cache/bundler/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:146:in `to_app'
/home/rof/cache/bundler/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:160:in `block in generate_map'
/home/rof/cache/bundler/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:160:in `each'
/home/rof/cache/bundler/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:160:in `generate_map'
/home/rof/cache/bundler/ruby/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:145:in `to_app'
/home/rof/cache/bundler/ruby/2.2.0/gems/capybara-2.4.4/lib/capybara/rails.rb:13:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/rof/cache/bundler/ruby/2.2.0/gems/rspec-rails-3.2.3/lib/rspec/rails/vendor/capybara.rb:7:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/rof/cache/bundler/ruby/2.2.0/gems/rspec-rails-3.2.3/lib/rspec/rails.rb:13:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/rof/cache/bundler/ruby/2.2.0/bundler/gems/rspec-cells-6049946b3079/lib/rspec/cells.rb:5:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/rof/cache/bundler/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/rof/cache/bundler/ruby/2.2.0/bundler/gems/rspec-cells-6049946b3079/lib/rspec-cells.rb:17:in `<top (required)>'
/home/rof/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.5/lib/bundler/runtime.rb:76:in `require'
/home/rof/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.5/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/rof/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.5/lib/bundler/runtime.rb:72:in `each'
/home/rof/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.5/lib/bundler/runtime.rb:72:in `block in require'
/home/rof/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `each'
/home/rof/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.5/lib/bundler/runtime.rb:61:in `require'
/home/rof/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.5/lib/bundler.rb:134:in `require'
/home/rof/src/bitbucket.org/hubbado/hubbadoproto/config/application.rb:7:in `<top (required)>'
/home/rof/src/bitbucket.org/hubbado/hubbadoproto/Rakefile:4:in `require'
/home/rof/src/bitbucket.org/hubbado/hubbadoproto/Rakefile:4:in `<top (required)>'

It runs just fine on my development box, it's only Codeship that's affected.

I've carefully gone through the build on a Codeship SSH session and I've isolated it to the "bundle update rspec-cells" command.

This is rake working before the update:

rof@railsonfire_95981500-275e-0133-512f-0efcb37b71e5_fa85a9fee872:~/clone$ bundle exec rake db:schema:load 
-- enable_extension("plpgsql")
   -> 0.0155s
-- create_table("achievements", {:force=>:cascade})
   -> 0.0054s
-- create_table("acquired_certifications", {:force=>:cascade})
   -> 0.0040s

etc.

Then, after executing:

bundle update rspec-cells

rake fails with the 'missing run or map statement' error shown above.

The following diff is shown in Gemfile.lock:

$ git diff Gemfile.lock
diff --git a/Gemfile.lock b/Gemfile.lock
index 638bcd7..e462a36 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -44,7 +44,7 @@ GIT

 GIT
   remote: https://github.com/apotonick/rspec-cells
-  revision: 41aa4f865da36074604faf3587924e16312ec50f
+  revision: 6049946b3079fec135bce17b8bee4ccd3d5fe3ea
   specs:
     rspec-cells (0.3.3)
       cells (~> 4.0.0.beta5)

8fbc9bc breaks Rails (v4.2.1) controller specs

Commit: 8fbc9bc

It appears this commit breaks Rails (v4.2.1) controller specs. Minimal example:

require 'rails_helper'

RSpec.describe PagesController, type: :controller do
  describe 'GET #home' do
    it 'returns http success' do
      get :home
      expect(response).to have_http_status(:success)
    end
  end
end

Error returned:

Failure/Error: get :home
     RuntimeError:
       @controller is nil: make sure you set it in your test's setup method.
     # ./spec/controllers/pages_controller_spec.rb:7:in `block (3 levels) in <top (required)>'

rspec-cells 0.3.6 is broken with ruby <= 2.6

For example, expect(array).to be_all { some_block } is broken. Because it evaluates as array.all?({}) instead of array.all? { some_block }.

I think since aa3abc9.

class C
  def foo(pattern=nil, &block)
    p [pattern, block_given?]
  end
end

class C1
  def method_missing(method, *args, &block)
    C.new.send(method, *args, &block)
  end
end

class C2
  def method_missing(method, *args, **kwargs, &block)
    C.new.send(method, *args, **kwargs, &block)
  end
end

C1.new.foo {}
C2.new.foo {}

With ruby <= 2.6:

[nil, true]
[{}, true]

With ruby >= 2.7:

[nil, true]
[nil, true]

Cannot use Capybara finders

I am trying to write a test for a link for its attributes

Currently I am using

it {should have_css("a.btn[data-method='post'][href='#{some_path)}']")}

But it's too long and hard to read

So I have this:

subject do
  find_link(name)
end

it {should exist}

specify {subject[:href].should eq some_path}
specify {subject[:class].should eq '.btn'}
specify {subject['data-method'].should eq 'post'}

specify {subject[:rel].should eq :tooltip}
specify {subject[:title].should eq "Some Action"}

But find_link method is not defined

Actually I want to use have_link but the option only supports href

Gem Load Error is: uninitialized constant Cell::Testing::Uber

I am using trailblazer in my project and when installing rspec-cells gem get error:
/gems/bundler-1.12.5/lib/bundler/runtime.rb:89:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'rspec-cells'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant Cell::Testing::Ube

*** LOCAL GEMS ***

aasm (4.10.1)
actionmailer (4.2.6)
actionpack (4.2.6)
actionview (4.2.6)
activejob (4.2.6)
activemodel (4.2.6)
activerecord (4.2.6)
activesupport (4.2.6)
addressable (2.3.8)
airbrussh (1.0.2)
arel (6.0.3)
ast (2.3.0)
autoprefixer-rails (6.3.6.2)
axiom-types (0.1.1)
babel-source (5.8.35)
babel-transpiler (0.7.0)
bcrypt (3.1.11)
better_errors (2.1.1)
bigdecimal (1.2.8)
binding_of_caller (0.7.2)
bootstrap-datepicker-rails (1.6.1.1)
bootstrap-sass (3.3.6)
breadcrumbs_on_rails (2.3.1)
builder (3.2.2)
bundler (1.12.5)
bundler-unload (1.0.2)
callsite (0.0.11)
capistrano (3.5.0)
capistrano-bundler (1.1.4)
capistrano-harrow (0.5.1)
capistrano-rails (1.1.7)
capistrano-rvm (0.1.2)
capistrano-thin (1.2.0)
capybara (2.7.1)
carrierwave (0.11.2)
cells (4.1.1)
cells-haml (0.0.10)
cells-rails (0.0.5)
choice (0.2.0)
ci_reporter (2.0.0)
ci_reporter_rspec (1.0.0)
cliver (0.3.2)
cocoon (1.2.9)
codeclimate-engine-rb (0.3.1)
coderay (1.1.1)
coercible (1.0.0)
coffee-rails (4.0.1)
coffee-script (2.4.1)
coffee-script-source (1.10.0)
commonjs (0.2.7)
concurrent-ruby (1.0.2)
daemons (1.2.3)
database_cleaner (1.5.3)
debug_inspector (0.0.2)
declarative (0.0.7)
descendants_tracker (0.0.4)
devise (4.1.1)
did_you_mean (1.0.0)
diff-lcs (1.2.5)
disposable (0.2.6)
docile (1.1.5)
domain_name (0.5.20160310)
dotenv (2.1.1)
dotenv-rails (2.1.1)
email_validator (1.6.0)
equalizer (0.0.11)
erubis (2.7.0)
eventmachine (1.2.0.1)
execjs (2.7.0)
executable-hooks (1.3.2)
factory_girl (4.7.0)
factory_girl_rails (4.7.0)
faker (1.6.3)
font-awesome-rails (4.3.0.0)
friendly_id (5.1.0)
gem-wrappers (1.2.7)
git-version-bump (0.15.1)
globalid (0.3.6)
haml (4.1.0.beta.1)
haml-rails (0.9.0)
has_scope (0.7.0)
hpricot (0.8.6)
html2haml (1.0.1)
http-cookie (1.0.2)
i18n (0.7.0)
ice_nine (0.11.2)
io-console (0.4.5)
jbuilder (1.5.3)
jquery-rails (4.1.1)
json (1.8.3)
json-schema (2.6.2)
json-schema-rspec (0.0.4)
kaminari (0.17.0)
kaminari-cells (0.0.4)
launchy (2.4.3)
less (2.6.0)
less-rails (2.7.1)
letter_opener (1.4.1)
libv8 (3.16.14.15 x86-linux)
loofah (2.0.3)
mail (2.6.4)
mailjet (1.3.8)
meta_request (0.4.0)
mime-types (2.99.2)
mimemagic (0.3.1)
mini_portile2 (2.1.0)
minitest (5.9.0, 5.8.3)
money (6.7.1)
mono_logger (1.1.0)
multi_json (1.12.1)
net-scp (1.2.1)
net-ssh (3.1.1)
net-telnet (0.1.1)
netrc (0.11.0)
newrelic_rpm (3.16.0.318)
nokogiri (1.6.8)
orm_adapter (0.5.0)
parser (2.3.1.2)
pg (0.18.4)
phantomjs (2.1.1.0)
pkg-config (1.1.7)
poltergeist (1.9.0)
power_assert (0.2.6)
powerpack (0.1.1)
psych (2.0.17)
pundit (1.1.0)
rack (1.6.4)
rack-contrib (1.4.0)
rack-protection (1.5.3)
rack-test (0.6.3)
rails (4.2.6)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.7)
rails-erd (1.4.7)
rails-html-sanitizer (1.0.3)
rails_12factor (0.0.3)
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (4.2.6)
rainbow (2.1.0)
rake (11.2.2, 10.4.2)
rdoc (4.2.2, 4.2.1)
redis (3.2.2)
redis-actionpack (4.0.1)
redis-activesupport (4.1.5)
redis-namespace (1.5.2)
redis-rack (1.5.0)
redis-rails (4.0.0)
redis-session-store (0.8.1)
redis-store (1.1.7)
reek (4.2.1)
ref (2.0.0)
reform (2.1.0)
representable (3.0.0)
responders (2.2.0)
resque (1.25.2)
resque-meta (2.0.1)
resque-progress (1.0.1)
resque-scheduler (4.0.0)
resque-scheduler-web (0.0.4)
resque-web (0.0.8)
resque_mailer (2.2.7)
rest-client (1.8.0)
rmagick (2.15.4)
rspec (3.4.0)
rspec-core (3.4.4)
rspec-expectations (3.4.0)
rspec-mocks (3.4.1)
rspec-rails (3.4.2)
rspec-support (3.4.1)
rubocop (0.40.0)
ruby-graphviz (1.2.2)
ruby-progressbar (1.8.1)
ruby_parser (3.1.3)
rubygems-bundler (1.4.4)
rubyzip (1.2.0)
rufus-scheduler (3.2.1)
rvm (1.11.3.9)
sass (3.4.22)
sass-rails (5.0.4)
sdoc (0.4.1)
sexp_processor (4.7.0)
shoulda-callback-matchers (1.1.4)
shoulda-matchers (3.1.1)
simple_form (3.2.1)
simple_xlsx_reader (1.0.2)
simplecov (0.11.2)
simplecov-html (0.10.0)
simplecov-rcov (0.2.3)
sinatra (1.4.7)
sixarm_ruby_unaccent (1.1.1)
sprockets (3.6.0)
sprockets-es6 (0.9.0)
sprockets-rails (3.0.4)
sshkit (1.11.0)
test-unit (3.1.5)
test_after_commit (1.0.0)
therubyracer (0.12.2)
thin (1.7.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
timecop (0.8.1)
trailblazer (1.1.1)
trailblazer-cells (0.0.3)
trailblazer-loader (0.0.9)
trailblazer-rails (0.2.4)
turbolinks (2.5.3)
twitter-bootstrap-rails (3.2.2)
tzinfo (1.2.2)
uber (0.0.15)
uglifier (3.0.0)
unf (0.1.4)
unf_ext (0.0.7.2)
unicode-display_width (1.0.5)
vegas (0.1.11)
virtus (1.0.5)
warden (1.2.6)
websocket-driver (0.6.4)
websocket-extensions (0.1.2)
xpath (2.0.0)
require 'rails_helper'

describe Offer::Cell::Item, type: :cell do
  include ::Cell::Testing
end

allow syntax

Hey Folks,

I am working with rspec-cells and want to stup a cell. I get a deprecation warning for stubbing than I use album_cell.stub(:album).and_return('Johnny') so I try the new Rspec 3 syntax allow(album_cell).to receive(:album).and_return('Johnny').

If I try the new syntax everything is blowing of without any useful message. Is the way I want to use the new Rspec 3 syntax valid in Rspec-cells?

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

  spec.license = 'MIT'
  # or
  spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

NoMethodError when using route helpers

Hi,

Im getting a NoMethodError: undefined method `[]' for nil:NilClass
in rspec-testing when using path helpers. I have included the controller via the controller-method, and tried setting the type to :cell, but it doesn't help.
Using Rails 5.1 and Slim.

generated cells not rendering in specs

I'm having some trouble getting rspec-cells to run cleanly.

Namely, I generated a cell with:

bundle exec rails g cell task listing -e haml -t rspec

and when I test the generated cell and spec, I get this error:

  1) TaskCell cell rendering rendering listing
     Failure/Error: it { should have_selector("h1", :content => "Task#listing") }
       expected following output to contain a <h1>Task#listing</h1> tag:
       <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
       <html><body><p>#<:node::simple:0x007fb2850c5e60></:node::simple:0x007fb2850c5e60></p></body></html>
     # ./spec/cells/task_cell_spec.rb:15:in `block (4 levels) in <top (required)>'

Has anyone seen that sort of thing before, or else have any ideas? FWIW, I'm running Rails 3.2.11 with the latest capybara.

can't start rails server

After update to 0.1.3 starting rails server causes this error:

../gems/rspec-cells-0.1.3/lib/rspec/rails/example/cell_example_group.rb:66:in `<top (required)>': undefined method `configure' for RSpec:Module (NoMethodError)

All spec about `respond_to` failed on `0.1.11`

I generated a cell for testing this bug, this is fine in 0.1.10

require 'spec_helper'

describe TestCell do

  context "cell instance" do
    subject { cell(:test) }

    it { should respond_to(:test) }
  end

  context "cell rendering" do
    context "rendering test" do
      subject { render_cell(:test, :test) }

      it { should have_selector("h1", :text => "Test#test") }
      it { should have_selector("p", :text => "Find me in app/cells/test/test.html") }
    end
  end

end
expected #<RSpec::Rails::CellExampleGroup::Content:0x007fc36e2e8a40 @cell=#<TestCell:0x007fc36e2e8ba8 @_action_has_layout=true, @_routes=nil, @request=#<#<Class:0x007fc36d41a1f8>:0x007fc36d4af640 @_routes=nil, @_action_has_layout=true, @_headers={"Content-Type"=>"text/html"}, @_status=200, @_request=#<ActionController::TestRequest:0x007fc36d4af500 @env={"rack.version"=>[1, 2], "rack.input"=>#<StringIO:0x007fc3681eca48>, "rack.errors"=>#<StringIO:0x007fc3681ece30>, "rack.multithread"=>true, "rack.multiprocess"=>true, "rack.run_once"=>false, "REQUEST_METHOD"=>"GET", "SERVER_NAME"=>"example.org", "SERVER_PORT"=>"80", "QUERY_STRING"=>"", "rack.url_scheme"=>"http", "HTTPS"=>"off", "SCRIPT_NAME"=>"", "CONTENT_LENGTH"=>"0", "HTTP_HOST"=>"test.host", "REMOTE_ADDR"=>"0.0.0.0", "HTTP_USER_AGENT"=>"Rails Testing", "action_dispatch.routes"=>#<ActionDispatch::Routing::RouteSet:0x007fc36bb51b58>, "action_dispatch.parameter_filter"=>[:password], "action_dispatch.redirect_filter"=>[], "action_dispatch.secret_token"=>"277212ba224b72c66bfa217ebf2acb765760a882504bced178fd8e97595c1368edfaffbd20502549cd2e7c32f1f61a2955ee4f136d7071f5abe3b414f790ebf2", "action_dispatch.secret_key_base"=>"041f7683c191682e2ac7b9dafef89b97477c3a9ee4114e68e251a0e1348b4aaa3a24db3b726d1a19555a93200ad88ab21c182dddbfff5277f8f064f88dc6db8c", "action_dispatch.show_exceptions"=>false, "action_dispatch.show_detailed_exceptions"=>true, "action_dispatch.logger"=>#<ActiveSupport::Logger:0x007fc36973e518 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x007fc36973e4a0 @datetime_format=nil>, @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x007fc36bb09b78 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x007fc36973e400 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<File:/Users/PikachuEXE/Projects/spacious-rails/log/test.log>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007fc36973e3d8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fc36973e388>>>>, "action_dispatch.backtrace_cleaner"=>#<Rails::BacktraceCleaner:0x007fc36d4e69b0 @filters=[#<Proc:0x007fc36d4e64d8@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:10>, #<Proc:0x007fc36d4e64b0@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:11>, #<Proc:0x007fc36d4e6488@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:12>, #<Proc:0x007fc36d4e5c40@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:24>], @silencers=[#<Proc:0x007fc36d4e5c18@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:15>]>, "action_dispatch.key_generator"=>#<ActiveSupport::CachingKeyGenerator:0x007fc36d4e5b78 @key_generator=#<ActiveSupport::KeyGenerator:0x007fc36d4e5ba0 @secret="041f7683c191682e2ac7b9dafef89b97477c3a9ee4114e68e251a0e1348b4aaa3a24db3b726d1a19555a93200ad88ab21c182dddbfff5277f8f064f88dc6db8c", @iterations=1000>, @cache_keys=#<ThreadSafe::Cache:0x007fc36d4e5b50 @backend={}, @default_proc=nil>>, "action_dispatch.http_auth_salt"=>"http authentication", "action_dispatch.signed_cookie_salt"=>"signed cookie", "action_dispatch.encrypted_cookie_salt"=>"encrypted cookie", "action_dispatch.encrypted_signed_cookie_salt"=>"signed encrypted cookie", "rack.session"=>{}, "rack.session.options"=>{:key=>"rack.session", :path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :sidbits=>128, :cookie_only=>true, :secure_random=>SecureRandom, :id=>"374848aafafe2e813c34c47d178cea38"}}, @symbolized_path_params=nil, @filtered_parameters=nil, @filtered_env=nil, @filtered_path=nil, @protocol=nil, @port=nil, @method=nil, @request_method=nil, @remote_ip=nil, @original_fullpath=nil, @fullpath=nil, @ip=nil, @uuid=nil>, @_response=#<ActionController::TestResponse:0x007fc36d4e5060 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fc36d4e4fc0>, @stream=#<ActionDispatch::Response::Buffer:0x007fc36d4e4ef8 @response=#<ActionController::TestResponse:0x007fc36d4e5060 ...>, @buf=[], @closed=false>, @header={"X-Frame-Options"=>"SAMEORIGIN", "X-XSS-Protection"=>"1; mode=block", "X-Content-Type-Options"=>"nosniff", "X-UA-Compatible"=>"chrome=1"}, @status=200, @sending_file=false, @blank=false, @cv=#<MonitorMixin::ConditionVariable:0x007fc36d4e4ed0 @monitor=#<ActionController::TestResponse:0x007fc36d4e5060 ...>, @cond=#<ConditionVariable:0x007fc36d4e4ea8 @waiters={}, @waiters_mutex=#<Mutex:0x007fc36d4e4e58>>>, @committed=false, @content_type=nil, @charset=nil, @cache_control={}, @etag=nil>, @_params={}>, @parent_controller=#<#<Class:0x007fc36d41a1f8>:0x007fc36d4af640 @_routes=nil, @_action_has_layout=true, @_headers={"Content-Type"=>"text/html"}, @_status=200, @_request=#<ActionController::TestRequest:0x007fc36d4af500 @env={"rack.version"=>[1, 2], "rack.input"=>#<StringIO:0x007fc3681eca48>, "rack.errors"=>#<StringIO:0x007fc3681ece30>, "rack.multithread"=>true, "rack.multiprocess"=>true, "rack.run_once"=>false, "REQUEST_METHOD"=>"GET", "SERVER_NAME"=>"example.org", "SERVER_PORT"=>"80", "QUERY_STRING"=>"", "rack.url_scheme"=>"http", "HTTPS"=>"off", "SCRIPT_NAME"=>"", "CONTENT_LENGTH"=>"0", "HTTP_HOST"=>"test.host", "REMOTE_ADDR"=>"0.0.0.0", "HTTP_USER_AGENT"=>"Rails Testing", "action_dispatch.routes"=>#<ActionDispatch::Routing::RouteSet:0x007fc36bb51b58>, "action_dispatch.parameter_filter"=>[:password], "action_dispatch.redirect_filter"=>[], "action_dispatch.secret_token"=>"277212ba224b72c66bfa217ebf2acb765760a882504bced178fd8e97595c1368edfaffbd20502549cd2e7c32f1f61a2955ee4f136d7071f5abe3b414f790ebf2", "action_dispatch.secret_key_base"=>"041f7683c191682e2ac7b9dafef89b97477c3a9ee4114e68e251a0e1348b4aaa3a24db3b726d1a19555a93200ad88ab21c182dddbfff5277f8f064f88dc6db8c", "action_dispatch.show_exceptions"=>false, "action_dispatch.show_detailed_exceptions"=>true, "action_dispatch.logger"=>#<ActiveSupport::Logger:0x007fc36973e518 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x007fc36973e4a0 @datetime_format=nil>, @formatter=#<ActiveSupport::Logger::SimpleFormatter:0x007fc36bb09b78 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x007fc36973e400 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<File:/Users/PikachuEXE/Projects/spacious-rails/log/test.log>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007fc36973e3d8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fc36973e388>>>>, "action_dispatch.backtrace_cleaner"=>#<Rails::BacktraceCleaner:0x007fc36d4e69b0 @filters=[#<Proc:0x007fc36d4e64d8@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:10>, #<Proc:0x007fc36d4e64b0@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:11>, #<Proc:0x007fc36d4e6488@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:12>, #<Proc:0x007fc36d4e5c40@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:24>], @silencers=[#<Proc:0x007fc36d4e5c18@/Users/PikachuEXE/.rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.4/lib/rails/backtrace_cleaner.rb:15>]>, "action_dispatch.key_generator"=>#<ActiveSupport::CachingKeyGenerator:0x007fc36d4e5b78 @key_generator=#<ActiveSupport::KeyGenerator:0x007fc36d4e5ba0 @secret="041f7683c191682e2ac7b9dafef89b97477c3a9ee4114e68e251a0e1348b4aaa3a24db3b726d1a19555a93200ad88ab21c182dddbfff5277f8f064f88dc6db8c", @iterations=1000>, @cache_keys=#<ThreadSafe::Cache:0x007fc36d4e5b50 @backend={}, @default_proc=nil>>, "action_dispatch.http_auth_salt"=>"http authentication", "action_dispatch.signed_cookie_salt"=>"signed cookie", "action_dispatch.encrypted_cookie_salt"=>"encrypted cookie", "action_dispatch.encrypted_signed_cookie_salt"=>"signed encrypted cookie", "rack.session"=>{}, "rack.session.options"=>{:key=>"rack.session", :path=>"/", :domain=>nil, :expire_after=>nil, :secure=>false, :httponly=>true, :defer=>false, :renew=>false, :sidbits=>128, :cookie_only=>true, :secure_random=>SecureRandom, :id=>"374848aafafe2e813c34c47d178cea38"}}, @symbolized_path_params=nil, @filtered_parameters=nil, @filtered_env=nil, @filtered_path=nil, @protocol=nil, @port=nil, @method=nil, @request_method=nil, @remote_ip=nil, @original_fullpath=nil, @fullpath=nil, @ip=nil, @uuid=nil>, @_response=#<ActionController::TestResponse:0x007fc36d4e5060 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fc36d4e4fc0>, @stream=#<ActionDispatch::Response::Buffer:0x007fc36d4e4ef8 @response=#<ActionController::TestResponse:0x007fc36d4e5060 ...>, @buf=[], @closed=false>, @header={"X-Frame-Options"=>"SAMEORIGIN", "X-XSS-Protection"=>"1; mode=block", "X-Content-Type-Options"=>"nosniff", "X-UA-Compatible"=>"chrome=1"}, @status=200, @sending_file=false, @blank=false, @cv=#<MonitorMixin::ConditionVariable:0x007fc36d4e4ed0 @monitor=#<ActionController::TestResponse:0x007fc36d4e5060 ...>, @cond=#<ConditionVariable:0x007fc36d4e4ea8 @waiters={}, @waiters_mutex=#<Mutex:0x007fc36d4e4e58>>>, @committed=false, @content_type=nil, @charset=nil, @cache_control={}, @etag=nil>, @_params={}>>> to respond to :test

./spec/cells/test_cell_spec.rb:8:in `block (3 levels) in <top (required)>'

Generated spec doesn't pass: have_selector 'h1' working, but with text: 'xy' doesn't

My generated cell:

h1
  MiniHub#show
p
  Find me in app/cells/mini_hub/show.html.slim

My generated spec (with text: instead of content:, see #33):

require 'spec_helper'

describe MiniHubCell do

  context 'cell instance' do
    subject { cell :mini_hub }

    it { should respond_to :show }
  end

  context 'cell rendering' do
    context 'rendering show' do
      subject { render_cell :mini_hub, :show }

      it { should have_selector 'h1', text: 'MiniHub#show' }
      it { should have_selector 'p', text: 'Find me in app/cells/mini_hub/show.html' }
    end
  end

end

Output:

  1) MiniHubCell cell rendering rendering show should have selector "h1", {:text=>"MiniHub#show"}
     Failure/Error: it { should have_selector 'h1', text: 'MiniHub#show' }
       expected #has_selector?("h1", {:text=>"MiniHub#show"}) to return true, got false
     # ./spec/cells/mini_hub_cell_spec.rb:15:in `block (4 levels) in <top (required)>'

  2) MiniHubCell cell rendering rendering show should have selector "p", {:text=>"Find me in app/cells/mini_hub/show.html"}
     Failure/Error: it { should have_selector 'p', text: 'Find me in app/cells/mini_hub/show.html' }
       expected #has_selector?("p", {:text=>"Find me in app/cells/mini_hub/show.html"}) to return true, got false
     # ./spec/cells/mini_hub_cell_spec.rb:16:in `block (4 levels) in <top (required)>'

When only checking for the selector (without text:), it's working:

      it { should have_selector 'h1' }
      it { should have_selector 'p' }

When checking only for the content, it's not:

      it { should have_content 'MiniHub#show' }
      it { should have_content 'Find me in app/cells/mini_hub/show.html' }
  1) MiniHubCell cell rendering rendering show should have content "MiniHub#show"
     Failure/Error: it { should have_content 'MiniHub#show' }
       expected #has_content?("MiniHub#show") to return true, got false
     # ./spec/cells/mini_hub_cell_spec.rb:15:in `block (4 levels) in <top (required)>'

  2) MiniHubCell cell rendering rendering show should have content "Find me in app/cells/mini_hub/show.html"
     Failure/Error: it { should have_content 'Find me in app/cells/mini_hub/show.html' }
       expected #has_content?("Find me in app/cells/mini_hub/show.html") to return true, got false
     # ./spec/cells/mini_hub_cell_spec.rb:16:in `block (4 levels) in <top (required)>'

An .inspect of subject results in this:

=> "#<Capybara::Node::Simple:0x007ff448628b78 @native=#<Nokogiri::HTML::Document:0x3ffa243180f4 name=\"document\" children=[#<Nokogiri::XML::DTD:0x3ffa2431c4ec name=\"html\">, #<Nokogiri::XML::Element:0x3ffa2431df04 name=\"html\" children=[#<Nokogiri::XML::Element:0x3ffa2432176c name=\"body\" children=[#<Nokogiri::XML::Element:0x3ffa24320aec name=\"h1\" children=[#<Nokogiri::XML::Element:0x3ffa243201f0 name=\"minihub\" attributes=[#<Nokogiri::XML::Attr:0x3ffa243200d8 name=\"id\" value=\"show\">]>]>, #<Nokogiri::XML::Element:0x3ffa2432536c name=\"p\" children=[#<Nokogiri::XML::Element:0x3ffa24324dcc name=\"find\" children=[#<Nokogiri::XML::Text:0x3ffa243249e4 \"me in app/cells/mini_hub/show.html.slim\">]>]>]>]>]>>"

Please help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.