danger / danger-plugin-template

An opinionated template for creating a Danger plugin
Other
20 stars 10 forks source link

undefined method `my_plugin' #11

Closed felipesabino closed 7 years ago

felipesabino commented 7 years ago

Trying to execute RSpec for newly generated plugin yields to undefined method my_plugin error.

Steps to reproduce

  1. git clone this repo
  2. $ ./configure
  3. $ git remote -v to make sure there is a remote configured because of #7 , but apparently ./configure removes it, so we add it again with $ git remote add
  4. $ rspec -fd to show all tests executed
  5. 💥
$ git clone https://github.com/danger/danger-plugin-template.git
Cloning into 'danger-plugin-template'...
remote: Counting objects: 189, done.
remote: Total 189 (delta 0), reused 0 (delta 0), pack-reused 189
Receiving objects: 100% (189/189), 26.54 KiB | 0 bytes/s, done.
Resolving deltas: 100% (78/78), done.
Checking connectivity... done.

$ cd danger-plugin-template

$ ./configure danger-plugin_test
Configuring danger-plugin_test
user name:Felipe Sabino
user email:felipe@sabino.me
year:2016

$ git remote -v

$ git remote add origin https://github.com/danger/danger-plugin-template.git

$ rspec -f d

Danger::DangerPluginTest
  should be a plugin
  with Dangerfile
    Warns on a monday (FAILED - 1)
    Does nothing on a tuesday (FAILED - 2)

Failures:

  1) Danger::DangerPluginTest with Dangerfile Warns on a monday
     Failure/Error: @my_plugin = @dangerfile.my_plugin

     NoMethodError:
       undefined method `my_plugin' for #<Danger::Dangerfile:0x007fe9eddf46f0>
     # /Users/felipesabino/.rvm/gems/ruby-2.2.3/gems/danger-3.5.5/lib/danger/danger_core/dangerfile.rb:68:in `method_missing'
     # ./spec/plugin_test_spec.rb:15:in `block (3 levels) in <module:Danger>'

  2) Danger::DangerPluginTest with Dangerfile Does nothing on a tuesday
     Failure/Error: @my_plugin = @dangerfile.my_plugin

     NoMethodError:
       undefined method `my_plugin' for #<Danger::Dangerfile:0x007fe9eddd6970>
     # /Users/felipesabino/.rvm/gems/ruby-2.2.3/gems/danger-3.5.5/lib/danger/danger_core/dangerfile.rb:68:in `method_missing'
     # ./spec/plugin_test_spec.rb:15:in `block (3 levels) in <module:Danger>'

Finished in 0.02137 seconds (files took 0.39813 seconds to load)
3 examples, 2 failures

Failed examples:

rspec ./spec/plugin_test_spec.rb:21 # Danger::DangerPluginTest with Dangerfile Warns on a monday
rspec ./spec/plugin_test_spec.rb:30 # Danger::DangerPluginTest with Dangerfile Does nothing on a tuesday

Environment:

OSX 10.11.6 Ruby 2.2.3p173 Danger 3.5.5

orta commented 7 years ago

Yeah, this is on purpose, it's to give people an example of what it should look like - I guess the entire template could be a working plugin though?

felipesabino commented 7 years ago

@orta I think there is an issue.

Apparently my_plugin should also have been replaced when ./configure runs. I will submit a PR in the next minutes for you to check.

orta commented 7 years ago

rock 👍