Giter VIP home page Giter VIP logo

sinatra-mvc-file-structure's Issues

needs content

Refer to Readme for content to be included

due 9/17/2015 - using content from other repos here

Include Sample App Code

This repo includes code for a very basic sample app.

The README works entirely without that code. However, in theory, it'd be nice if this README included a working sample app and referenced it's source code within the README. We'd have to instruct the student to clone the lab and play and explore the local files as they go through the README.

Lag

very slow loading.

RPEC test inconsistent

application_controller_spec.rb

should read something like

it 'can change dog age' do
  @dog = Dog.new("rudolph", "mastiff", 2)
  @dog.age = 3
  expect(@dog.age).to eq(3)
end

currently reads

it 'can change dog age' do
  @dog = Dog.new("rudolph", "mastiff", 2)
  @dog. name = "bessie"
  expect(@dog.name).to eq("bessie")
end

There's a test missing in the spec/controllers/application_controller_spec.rb file.

Hi. This lesson is really good, but I noticed that there was a test missing. There should be a test that checks for whether you can change the dog's breed. Something like this:

describe ApplicationController do
  describe 'Dog class' do
    ...
    # Maybe put this between the tests that check for changing the dog's name and age:
    it 'can change dog breed' do
      @dog = Dog.new("rudolph", "mastiff", 2)
      @dog.breed = "beagle"
      expect(@dog.breed).to eq("beagle")
    end
    ...
  end
end

Thanks as always for looking into this!

Sdcrouse

Test output changes each time rspec is run

The spec that tests Dog.all.count returns different output each time rspec is run. See example below.

Failures:

  1) ApplicationController Dog class can create a dog with attributes on initialization
     Failure/Error: expect(Dog.all.count).to eq (1)

       expected: 1
            got: 3

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:7:in `block (3 levels) in <top (required)>'

Finished in 0.05782 seconds (files took 0.35458 seconds to load)
7 examples, 1 failure

Failed examples:

rspec ./spec/controllers/application_controller_spec.rb:5 # ApplicationController Dog class can create a dog with attributes on initialization

And once I run rspec again

Failures:

  1) ApplicationController Dog class can create a dog with attributes on initialization
     Failure/Error: expect(Dog.all.count).to eq (1)

       expected: 1
            got: 5

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:7:in `block (3 levels) in <top (required)>'

Finished in 0.0462 seconds (files took 0.34495 seconds to load)
7 examples, 1 failure

Failed examples:

rspec ./spec/controllers/application_controller_spec.rb:5 # ApplicationController Dog class can create a dog with attributes on initialization

a little unclear

so let me disclaim this by saying that most people finished with lab without a problem but some were really hung up. there are no instructions, is purely test-driven which is fine but they've only see the whole "set an instance variable in the controller and render it in a view" thing once or twice and i don't think it was every discussed explicitly (i could be wrong!). So would be good to provide some basic instructions/a reminder about that instance variable -> view set-up.

Refers to controller action that hasn't been mentioned yet.

Under subhead: "views directory":

"We've filled in the views for you to display the dog Ralph we just created in our controller action. Feel free to take a look."

Nothing of the sort has been filled out that I could find, and this is the first mention of Ralph. I Googled around and eventually figured out how to pass the last test on my own, but wasted a lot of time checking other lessons and trying to find these examples. Hadn't actually written any erb or incorporated MVCs at all to this point. Seems like the lesson's out of order or the order was changed at some point without the readme being updated to reflect that.

Verify accuracy of Gemfile.lock description

The lesson text offers this explanation for the Gemfile.lock file: "The lock word is actually because it makes sure that only one thing is running bundle install at a time." This comes across as incorrect/misleading given that the purpose of the lock file is to document and enforce a specific working gem versions configuration.

rake (loadError) - Is this an error from my environment or part of the lesson to solve?

I honestly don't know if this is my fault but this works when I require 'rake' in my gemfile. I did run bundle install before issuing these commands. Is this a problem with my ruby environment setup?

12:38:31 activerecord-associations-intro
♥ rspec --fail-fast
/Users/yonk/Development/code/foo/activerecord-associations-intro/config/environment.rb:5:in require': cannot load such file -- rake (LoadError) from /Users/yonk/Development/code/foo/activerecord-associations-intro/config/environment.rb:5:in<top (required)>'
from /Users/yonk/Development/code/foo/activerecord-associations-intro/spec/spec_helper.rb:3:in require_relative' from /Users/yonk/Development/code/foo/activerecord-associations-intro/spec/spec_helper.rb:3:in<top (required)>'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:in require' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:inblock in requires='
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:in each' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:inrequires='
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:109:in block in process_options_into' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:108:ineach'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:108:in process_options_into' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:21:inconfigure'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:101:in setup' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:88:inrun'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:73:in run' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:41:ininvoke'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/exe/rspec:4:in <top (required)>' from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/rspec:23:inload'
from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/rspec:23:in <main>' from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:ineval'
from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `

'
12:39:37 activerecord-associations-intro

♥ bundle exec rspec --fail-fast
/Users/yonk/Development/code/foo/activerecord-associations-intro/config/environment.rb:5:in require': cannot load such file -- rake (LoadError) from /Users/yonk/Development/code/foo/activerecord-associations-intro/config/environment.rb:5:in<top (required)>'
from /Users/yonk/Development/code/foo/activerecord-associations-intro/spec/spec_helper.rb:3:in require_relative' from /Users/yonk/Development/code/foo/activerecord-associations-intro/spec/spec_helper.rb:3:in<top (required)>'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:in require' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:inblock in requires='
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:in each' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:inrequires='
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:109:in block in process_options_into' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:108:ineach'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:108:in process_options_into' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:21:inconfigure'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:101:in setup' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:88:inrun'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:73:in run' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:41:ininvoke'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/exe/rspec:4:in <top (required)>' from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/rspec:23:inload'
from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/rspec:23:in <main>' from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:ineval'
from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `

'
12:39:45 activerecord-associations-intro

/Users/yonk/Development/code/foo/activerecord-associations-intro/config/environment.rb:5:in require': cannot load such file -- rake (LoadError) from /Users/yonk/Development/code/foo/activerecord-associations-intro/config/environment.rb:5:in<top (required)>'
from /Users/yonk/Development/code/foo/activerecord-associations-intro/spec/spec_helper.rb:3:in require_relative' from /Users/yonk/Development/code/foo/activerecord-associations-intro/spec/spec_helper.rb:3:in<top (required)>'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:in require' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:inblock in requires='
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:in each' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration.rb:1280:inrequires='
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:109:in block in process_options_into' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:108:ineach'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:108:in process_options_into' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/configuration_options.rb:21:inconfigure'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:101:in setup' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:88:inrun'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:73:in run' from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/lib/rspec/core/runner.rb:41:ininvoke'
from /Users/yonk/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.3.0/exe/rspec:4:in <top (required)>' from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/rspec:23:inload'
from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/rspec:23:in <main>' from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:ineval'
from /Users/yonk/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `

'

♥ rvm -v
rvm 1.26.11 (latest) by Wayne E. Seguin [email protected], Michal Papis [email protected] [https://rvm.io/]
12:39:51 activerecord-associations-intro
♥ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
12:39:56 activerecord-associations-intro

Tests fail if first defined test does not run first

The defined tests fail if the first defined test (it 'can create a dog with attributes on initialization') does not run first. If other tests run before this one there are leftover dogs in the DOGS array.
The easiest way to avoid the problem is to add the following line to the .rspec file:
--order defined

This makes sure the tests run in the order they have been defined in the spec and that the test suite passes (when the task has been solved correctly).

Dogs tests not hinted at or explained at all in the README.md

So this lab is really quite confusing. I created a Dog class as a model that inherited from model.rb... assuming that's what they were looking for... anyway I got the tests to pass, and when I looked at the solution code after submitting I saw that they created an @dog instance var to pass to the erb file from ApplicationController... but this is a poorly designed lesson. I have a little background in rails and MVC pattern so I figured they were looking for a model (though there is no test nor hint that they want to create an instance to pass to the view here)... some better wording is needed to explain this random request for a simple Dog class... at least a hint that it should be a model or something. I can imagine a lot of students being totally lost on this, or creating code that passes but doesn't necessarily serve the purpose of introducing the idea of passing data from a model to controller to view...

Tests issue and file name extension issue

Last test in spec requires 'breed' to be 'dalmation' (it is hard-coded this way) so students will always have to instantiate a Dog class with the breed set to 'dalmation.' Otherwise test will fail.

  • Solution is to remove hard-coded breed 'dalmation'

View file extension should be index.html.erb and not index.erb

This lab is SO GOOD.

I usually flag issues with labs and lessons, but I just wanted to say this lab was really well done and the information in it is extremely helpful and easy to digest. Thank you!

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.