diff --git a/Gemfile b/Gemfile index fd00811..a2e7916 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ source "https://rubygems.org" gem 'sinatra' gem 'rake' gem 'thin' - gem 'shotgun' + gem 'shotgun', git: 'https://github.com/delonnewman/shotgun.git' gem 'pry' gem 'require_all' @@ -14,4 +14,4 @@ group :test do gem 'rspec' gem 'capybara' gem 'rack-test' - end \ No newline at end of file + end diff --git a/Gemfile.lock b/Gemfile.lock index 6072aff..86ceeab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,66 +1,94 @@ +GIT + remote: https://github.com/delonnewman/shotgun.git + revision: 600b3987db7f4774e2305247ff374327f1837857 + specs: + shotgun (0.9.2) + rack (>= 1.0) + GEM remote: https://rubygems.org/ specs: - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - capybara (2.18.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + base64 (0.2.0) + capybara (3.40.0) addressable + matrix mini_mime (>= 0.1.3) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (>= 2.0, < 4.0) - coderay (1.1.2) - daemons (1.2.6) - diff-lcs (1.3) - eventmachine (1.2.5) - method_source (0.9.0) - mini_mime (1.0.0) - mini_portile2 (2.3.0) - mustermann (1.0.2) - nokogiri (1.8.2) - mini_portile2 (~> 2.3.0) - pry (0.11.3) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - public_suffix (3.0.2) - rack (2.0.4) - rack-protection (2.0.1) - rack - rack-test (0.8.2) - rack (>= 1.0, < 3) - rake (12.3.0) - require_all (1.5.0) - rspec (3.7.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-core (3.7.1) - rspec-support (~> 3.7.0) - rspec-expectations (3.7.0) + nokogiri (~> 1.11) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) + coderay (1.1.3) + daemons (1.4.1) + diff-lcs (1.5.1) + eventmachine (1.2.7) + matrix (0.4.2) + method_source (1.1.0) + mini_mime (1.1.5) + mustermann (3.0.1) + ruby2_keywords (~> 0.0.1) + nokogiri (1.16.7-aarch64-linux) + racc (~> 1.4) + nokogiri (1.16.7-arm-linux) + racc (~> 1.4) + nokogiri (1.16.7-arm64-darwin) + racc (~> 1.4) + nokogiri (1.16.7-x86-linux) + racc (~> 1.4) + nokogiri (1.16.7-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.16.7-x86_64-linux) + racc (~> 1.4) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (6.0.1) + racc (1.8.1) + rack (2.2.9) + rack-protection (3.2.0) + base64 (>= 0.1.0) + rack (~> 2.2, >= 2.2.4) + rack-test (2.1.0) + rack (>= 1.3) + rake (13.2.1) + regexp_parser (2.9.2) + require_all (3.0.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-support (3.7.1) - shotgun (0.9.2) - rack (>= 1.0) - sinatra (2.0.1) - mustermann (~> 1.0) - rack (~> 2.0) - rack-protection (= 2.0.1) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + ruby2_keywords (0.0.5) + sinatra (3.2.0) + mustermann (~> 3.0) + rack (~> 2.2, >= 2.2.4) + rack-protection (= 3.2.0) tilt (~> 2.0) - thin (1.7.2) + thin (1.8.2) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - tilt (2.0.8) - xpath (3.0.0) + tilt (2.4.0) + xpath (3.2.0) nokogiri (~> 1.8) PLATFORMS - ruby + aarch64-linux + arm-linux + arm64-darwin + x86-linux + x86_64-darwin + x86_64-linux DEPENDENCIES capybara @@ -69,9 +97,9 @@ DEPENDENCIES rake require_all rspec - shotgun + shotgun! sinatra thin BUNDLED WITH - 1.16.1 + 2.5.15 diff --git a/app.rb b/app.rb index b1f74e9..2dc478f 100644 --- a/app.rb +++ b/app.rb @@ -1,5 +1,18 @@ require_relative 'config/environment' class App < Sinatra::Base + get "/" do + erb :index + end -end \ No newline at end of file + get "/new" do + erb :create_puppy + end + + post "/" do + @name = params[:name] + @age = params[:age] + @breed = params[:breed] + erb :display_puppy + end +end diff --git a/models/puppy.rb b/models/puppy.rb index e69de29..2b54bed 100644 --- a/models/puppy.rb +++ b/models/puppy.rb @@ -0,0 +1,9 @@ +class Puppy + attr_accessor :name, :breed, :age + + def initialize(name, breed, age) + @name = name + @breed = breed + @age = age + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cc6174d..023b3f1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,7 @@ RSpec.configure do |config| config.include Capybara::DSL config.include Rack::Test::Methods - config.order = 'default' + # config.order = 'default' end def app diff --git a/views/create_puppy.erb b/views/create_puppy.erb index e69de29..324df7c 100644 --- a/views/create_puppy.erb +++ b/views/create_puppy.erb @@ -0,0 +1,17 @@ +
diff --git a/views/display_puppy.erb b/views/display_puppy.erb index e69de29..ffacc82 100644 --- a/views/display_puppy.erb +++ b/views/display_puppy.erb @@ -0,0 +1,8 @@ +<%= @name %>
+<%= @breed %>
+<%= @age %>
+ + diff --git a/views/index.erb b/views/index.erb index e69de29..cf022e5 100644 --- a/views/index.erb +++ b/views/index.erb @@ -0,0 +1,2 @@ +